Telemetry-kit provides clear, actionable error messages that help you quickly identify and fix issues. All errors include:
Clear description of what went wrong
Common causes of the error
Actionable suggestions for fixing the problem
Context about where to find more information
Configuration errors occur when the SDK is not properly configured.
let result = TelemetryKit :: builder ()
. service_name ( "MyApp" ) // ❌ Contains uppercase
. build ();
// Error: Invalid configuration: service_name: 'MyApp' contains invalid characters.
// Use only lowercase letters, numbers, dashes, and underscores
// (e.g., 'my-app', 'cli_tool')
Fix: Use only lowercase letters, numbers, dashes, and underscores:
let telemetry = TelemetryKit :: builder ()
. service_name ( "my-app" ) // ✅ Valid
. build () ? ;
let config = SyncConfig :: builder ()
. org_id ( "my-org" ) // ❌ Not a valid UUID
. build ();
// Error: Invalid configuration: org_id 'my-org' is not a valid UUID.
// Expected format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Fix: Use a valid UUID:
let config = SyncConfig :: builder ()
. org_id ( "550e8400-e29b-41d4-a716-446655440000" ) // ✅ Valid UUID
. build () ? ;
let result = TelemetryKit :: builder ()
. build (); // ❌ No service_name provided
// Error: Invalid configuration: Missing required field: service_name
Fix: Provide all required fields:
let telemetry = TelemetryKit :: builder ()
. service_name ( "my-app" ) ? // ✅ Required field provided
. build () ? ;
Network errors occur when the SDK cannot communicate with the server.
// Error: HTTP request failed: connection refused
//
// Suggestion: Check network connectivity and verify the endpoint URL
Common causes:
Server is down or unreachable
Network connectivity issues
Invalid endpoint URL
Firewall blocking requests
Fix:
Check your internet connection
Verify the server is running
Test with curl: curl -I https://telemetry-kit.dev
Check firewall rules
// Error: HTTP request failed: failed to lookup address information
//
// Suggestion: Check network connectivity and verify the endpoint URL
Fix:
Check DNS configuration
Verify the endpoint URL is correct
Test DNS: nslookup telemetry-kit.dev
Authentication errors occur when credentials are invalid or expired.
// Error: Authentication failed: Invalid signature
//
// Suggestion: Verify your token and secret are correct
Common causes:
Invalid token or secret
Expired token
Token doesn't have required permissions
HMAC signature mismatch
Fix:
Verify credentials in your dashboard
Generate a new token if expired
Ensure secret matches the token
Check token permissions
Rate limiting errors occur when you exceed the allowed request rate.
// Error: Rate limit exceeded. Retry after 60 seconds.
//
// Suggestion: Batch events together or upgrade your plan
Fix:
Wait the specified duration before retrying
Batch events together:
// Instead of tracking events individually
for i in 0 .. 100 {
telemetry . track_command ( & format! ( "cmd_{}" , i), | e | {
e . success ( true )
}) .await? ;
}
// Batch them and sync once
telemetry . sync () .await? ;
Reduce event frequency
Consider upgrading your plan
Server errors occur when the server encounters an issue processing your request.
// Error: Server error (400): Invalid request body
//
// Suggestion: Check request parameters and ensure they're valid
Fix: Verify request parameters match the expected schema
// Error: Server error (401): Invalid credentials
//
// Suggestion: Verify your authentication token and secret
Fix: Check your token and secret are correct
// Error: Server error (403): Permission denied
//
// Suggestion: Your token doesn't have permission for this operation
Fix: Ensure your token has the required permissions
// Error: Server error (404): Endpoint not found
//
// Suggestion: Check the endpoint URL - resource not found
Fix: Verify the endpoint URL is correct
// Error: Server error (413): Request entity too large
//
// Suggestion: Request payload too large - reduce batch size
Fix: Reduce batch size:
let config = SyncConfig :: builder ()
. org_id (org_id) ?
. app_id (app_id) ?
. token (token)
. secret (secret)
. batch_size ( 50 ) // Reduce from default 100
. build () ? ;
// Error: Server error (429): Rate limit exceeded
//
// Suggestion: Rate limited - wait before retrying or upgrade plan
Fix: See Rate Limiting Errors
// Error: Server error (500): Internal server error
//
// Suggestion: Server error - retry with exponential backoff
Fix: The SDK automatically retries with exponential backoff. If the error persists, check the status page .
Database errors occur when there are issues with local event storage.
// Error: Database error: unable to open database file
//
// Suggestion: Check file permissions and ensure the database isn't locked by another process
Common causes:
Database file is locked by another process
Insufficient permissions to write
Disk full or quota exceeded
Corrupted database file
Fix:
Check file permissions: ls -la ~/.telemetry-kit/
Ensure no other process is using the database
Check disk space: df -h
Try deleting the database file (events will be lost):
rm ~/.telemetry-kit/my-app.db
Retry errors occur when an operation fails after multiple attempts.
// Error: Maximum retries exceeded
//
// Suggestion: Check server health and network connectivity, or enable offline mode
Fix:
Check server health at status.telemetry-kit.dev
Verify network connectivity
Enable offline mode (events will be queued):
let telemetry = TelemetryKit :: builder ()
. service_name ( "my-app" ) ?
. auto_sync ( false ) // Disable auto-sync
. build () ? ;
Don't panic on telemetry errors - they shouldn't crash your application:
// ❌ Bad: Panic on error
telemetry . track_command ( "build" , | e | e . success ( true )) .await. unwrap ();
// ✅ Good: Log and continue
if let Err (e) = telemetry . track_command ( "build" , | e | e . success ( true )) .await {
eprintln! ( "Failed to track event: {}" , e);
}
// ✅ Better: Use the ? operator in functions that return Result
async fn run () -> Result <()> {
telemetry . track_command ( "build" , | e | e . success ( true )) .await? ;
Ok (())
}
Set the RUST_LOG environment variable to see detailed error information:
RUST_LOG = telemetry_kit = debug cargo run
Validate configuration at startup, not at runtime:
// ✅ Good: Fail fast at startup
let telemetry = TelemetryKit :: builder ()
. service_name ( "my-app" ) ?
. with_sync_credentials (org_id, app_id, token, secret) ?
. build () ? ;
// Now all tracking calls will succeed (or fail gracefully)
telemetry . track_command ( "test" , | e | e . success ( true )) .await? ;
For critical events, implement your own retry logic:
use tokio :: time :: {sleep, Duration };
async fn track_with_retry (telemetry : & TelemetryKit ) -> Result <()> {
let mut attempts = 0 ;
let max_attempts = 3 ;
loop {
match telemetry . sync () .await {
Ok (_) => return Ok (()),
Err (e) if e . is_retryable () && attempts < max_attempts => {
attempts += 1 ;
let delay = Duration :: from_secs ( 2_ u64 . pow (attempts));
eprintln! ( "Sync failed, retrying in {:?}: {}" , delay, e);
sleep (delay) .await ;
}
Err (e) => return Err (e),
}
}
}
Track error rates to detect issues early:
use std :: sync :: atomic :: { AtomicUsize , Ordering };
static ERROR_COUNT : AtomicUsize = AtomicUsize :: new ( 0 );
if let Err (e) = telemetry . track_command ( "build" , | e | e . success ( true )) .await {
ERROR_COUNT . fetch_add ( 1 , Ordering :: Relaxed );
eprintln! ( "Telemetry error: {}" , e);
}
pub enum TelemetryError {
/// SQLite database error
Database ( rusqlite :: Error ),
/// HTTP request error
Http ( reqwest :: Error ),
/// JSON serialization error
Json ( serde_json :: Error ),
/// Invalid configuration
InvalidConfig ( String ),
/// Authentication error
Auth ( String ),
/// Rate limit exceeded
RateLimitExceeded { retry_after : u64 },
/// Server error with status code
ServerError { status : u16 , message : String },
/// Maximum retries exceeded
MaxRetriesExceeded ,
/// Invalid event schema
InvalidSchema ( String ),
/// IO error
Io ( std :: io :: Error ),
/// Machine ID error
MachineId ( String ),
/// Generic error
Other ( String ),
}
impl TelemetryError {
/// Check if the error is retryable
pub fn is_retryable ( & self ) -> bool ;
/// Create a configuration error
pub fn invalid_config (field : & str , reason : & str ) -> Self ;
/// Create a UUID validation error
pub fn invalid_uuid (field : & str , value : & str ) -> Self ;
/// Create a missing field error
pub fn missing_field (field : & str ) -> Self ;
}
If you encounter an error that isn't covered in this guide:
Check the logs : Enable debug logging with RUST_LOG=telemetry_kit=debug
Search GitHub Issues : github.com/ibrahimcesar/telemetry-kit/issues
Ask in Discussions : github.com/ibrahimcesar/telemetry-kit/discussions
Report a bug : github.com/ibrahimcesar/telemetry-kit/issues/new