Troubleshooting
Common issues and solutions when using Petnow SDK
Overview
This document covers platform-agnostic common issues that may occur when using Petnow SDK and their solutions. For platform-specific details, please refer to each platform's documentation.
API Authentication Issues
API Key Authentication Failure (401 Unauthorized)
Symptoms
401 Unauthorizederror when calling APIINVALID_API_KEYerror message
Causes
- Using incorrect API Key
- Bundle ID mismatch with registered API Key
- API Key expired or deactivated
Solutions
- Verify API Key
- Confirm using correct environment (Stage/Prod) Key
- Check for whitespace or special characters in API Key
- Verify Bundle ID match
- Confirm actual app Bundle ID matches registered Bundle ID
- Contact Petnow representative to verify API Key status
Environment Configuration Error
Symptoms
- Authentication failure when using Prod Key in Stage environment
- Mismatch between
isDebugModesetting and API Key
Cause
- Mismatch between
isDebugModeflag and API Key environment
Solution
✅ Correct combinations:
- isDebugMode: true + Stage API Key
- isDebugMode: false + Prod API Key
❌ Wrong combinations:
- isDebugMode: true + Prod API Key
- isDebugMode: false + Stage API KeyBiometric Upload Issues
Image Upload Failure
Symptoms
- Timeout or network error during file upload
FILE_TOO_LARGEerror
Causes
- File size exceeds limit (recommended: under 5MB)
- Unstable network connection
- Incorrect file format (only JPEG supported)
Solutions
- Compress images
- Adjust JPEG quality to 80-90%
- Adjust resolution to appropriate size (1920x1080 recommended)
- Implement retry logic
- Use exponential backoff
- Recommend max 3 retries
- Verify file format
- Upload only JPEG format
- Confirm file extension matches actual format
Job Polling Timeout
Symptoms
- Job status remains in
PROCESSINGstate - Unable to receive final result
Causes
- Server processing delay (low image quality or complex case)
- Incorrect Job ID
- Polling interval too short or timeout too short
Solutions
- Optimize polling settings
- Polling interval: 2-3 seconds recommended
- Max wait time: 60 seconds recommended
- Handle by job status
PROCESSING: Continue pollingSUCCESS: Process resultFAILED: Handle error and retry
- Re-upload on timeout
- Retry with new Job
Capture Session Issues
Symptoms
SESSION_NOT_FOUNDerrorSESSION_ALREADY_ENDEDerrorSESSION_TIMEOUTerror
Causes
- Session expired
- Attempting to upload to already ended session
- Incorrect session ID
Solutions
- Create new capture session
- Quickly upload and complete after session creation
- Correctly store and pass session ID
Pet Profile Management Issues
Metadata Parsing Failure
Symptoms
- JSON parsing error when querying metadata
- Specific fields are null or missing
Causes
- Saved in incorrect JSON format
- Encoding/decoding mismatch
- Special character handling error
Solutions
- Validate metadata on save
- Verify valid JSON format
- Use UTF-8 encoding
- Implement safe parsing
- Handle optional fields
- Provide default values
- Error handling with try-catch
- Document metadata schema
- Define required fields
- Specify data types
Partial Pet List Returned
Symptoms
- Only some pets returned when querying pet list
- Registered pet not in list
Causes
- Pet registered with different API Key
- Pet was deleted
- Server filtering (when pagination is supported in future)
Solutions
- Confirm using correct API Key
- Try direct query with specific pet ID
- Check existence with
GET /v2/pets/{petId}
- Check existence with
- Refresh list immediately after pet registration
Identification/Verification Issues
Low Verify Accuracy (1:1 Matching)
Symptoms
- Same pet returns
isVerified: false - Low confidence score
Causes
- Image quality difference between registration and verification
- Different capture conditions (lighting, angle, focus)
- Insufficient registered biometric data (only 1-2 fingerprints registered)
Solutions
- Provide sufficient biometric data during registration
- Fingerprint (nose) images: minimum 5 or more
- Appearance images: captured from various angles
- Maintain consistent capture conditions
- Natural or uniform lighting
- Maintain frontal angle
- Sharp focus
- Adjust confidence threshold
- Set threshold according to business requirements
- Implement additional verification logic for low confidence
Too Many Identify Results (1:N Matching)
Symptoms
- Identification results include unrelated pets
- Low confidence for Top 1 result
Causes
- Many pets with similar appearance in database
- Low uploaded image quality
- Threshold setting too low
Solutions
- Filter by confidence
- Display only top N (e.g., Top 3)
- Apply minimum confidence threshold (e.g., 70 or above)
- Filter with additional metadata
- Pre-filter by species, breed, region, etc.
- Add user confirmation process
- Show results to user and let them select
Network Issues
Intermittent Timeouts
Symptoms
- API calls occasionally timeout
- Failures even with good network status
Causes
- Server load
- Client timeout setting too short
- Proxy or firewall configuration
Solutions
- Increase timeout
- Request timeout: 30 seconds or more
- Resource timeout: 60 seconds or more
- Implement retry logic
- Use exponential backoff
- Set max retry count
- Check network status before request
- Verify network connectivity
- Monitor connection state changes
CORS Error (Web Environment)
Symptoms
- CORS policy violation error in browser
Access-Control-Allow-Originrelated error
Cause
- CORS restriction when calling API directly from web environment
Solutions
- Use backend proxy
- Client → Your backend → Petnow API
- Request domain registration from Petnow representative
- Request to add allowed Origin
Performance and Optimization
Excessive API Calls
Symptoms
- Too many API calls in short time
- Rate limit error (429 Too Many Requests)
Causes
- Unnecessary duplicate calls
- Polling interval too short
- Not using caching
Solutions
- Response caching
- Use local cache for pet list, pet info
- Set TTL (e.g., 5 minutes)
- Optimize polling
- Job polling interval: 2-3 seconds
- Limit max polling count
- Apply Debouncing/Throttling
- Prevent consecutive requests
Increasing Memory Usage
Symptoms
- Memory leak after image upload
- App gradually slows down
Causes
- Image data kept in memory continuously
- Unlimited cache growth
- Missing resource cleanup
Solutions
- Release immediately after image processing
- Release original data after upload completion
- Delete temporary files
- Limit cache size
- Set max cache size (e.g., 100MB)
- Use LRU policy
- Handle memory warnings
- Clear cache on system memory warning
Common Error Codes
| HTTP Status | Error Code | Description | Solution |
|---|---|---|---|
| 401 | INVALID_API_KEY | Invalid API Key | Verify API Key |
| 401 | BUNDLE_ID_MISMATCH | Bundle ID mismatch | Verify Bundle ID |
| 400 | INVALID_PARAMETER | Invalid parameter | Validate request parameters |
| 400 | FILE_TOO_LARGE | File size exceeded | Compress image |
| 400 | INSUFFICIENT_FINGERPRINTS | Insufficient fingerprints | Upload additional |
| 400 | SESSION_ALREADY_ENDED | Session ended | Create new session |
| 400 | SESSION_TIMEOUT | Session expired | Create new session |
| 404 | PET_NOT_FOUND | Pet not found | Verify Pet ID |
| 404 | JOB_NOT_FOUND | Job not found | Verify Job ID |
| 404 | SESSION_NOT_FOUND | Session not found | Verify Session ID |
| 409 | DUPLICATE_RESOURCE | Duplicate resource | Use existing resource |
| 429 | RATE_LIMIT_EXCEEDED | Request limit exceeded | Increase request interval |
| 500 | INTERNAL_SERVER_ERROR | Server internal error | Retry or request support |
| 503 | SERVICE_UNAVAILABLE | Service temporarily unavailable | Retry after a while |
Debugging Tips
1. Enable Debug Mode
When isDebugMode: true is set:
- Detailed error messages
- Request/response logs
- Use Stage environment2. Check Error Response Details
{
"error": {
"code": "ERROR_CODE",
"message": "Human readable message",
"field": "problematic_field",
"details": { "additional": "info" }
}
}3. Monitor Network Traffic
- Check network requests in developer tools
- Inspect request/response headers, body
- Analyze timing information
4. Collect Logs
- Record API call time, parameters, response
- Save full context when error occurs
- Create reproducible test cases
Support Request
If the problem is not resolved with the above solutions, please contact Petnow representative with the following information:
Required Information
- API Key (or masked form)
- Occurrence time (specify UTC or local timezone)
- Request parameters (excluding sensitive information)
- Error message and HTTP status code
- SDK version and platform information
Optional Information
- Reproduction steps
- Screenshots or log files
- Network environment (WiFi, 4G/5G, etc.)
- Difference between expected and actual behavior
Contact
- Email: support@petnow.io
- Direct contact with representative (contact provided upon contract)