Authentication Errors
Invalid or Expired Token
Symptom: Commands fail with “authentication failed” or “unauthorized” errors. Solution:Authentication tokens are stored at
$HOME/.harness/auth.json with restricted permissions (0600).Cannot Extract Account ID from Token
Symptom: Error message: “token does not contains accountID” Solution: The CLI expects tokens in the formatpat.AccountID.Random.Random. If you’re seeing this error:
- Verify your token format is correct
- Manually specify the account ID during login:
Permission Denied Errors
Symptom: Commands fail with “Access denied” or 403 errors. Causes:- Token lacks required permissions for the operation
- Organization or project scope is incorrect
- Resource doesn’t exist in the specified scope
Connection Issues
Cannot Connect to Harness API
Symptom: Error: “error connecting to Harness API” Possible Causes:- Network connectivity issues
- Incorrect API URL
- Firewall or proxy blocking the connection
- SSL certificate validation issues
Verify network connectivity
Verify network connectivity
Test basic connectivity to Harness:
Check API URL configuration
Check API URL configuration
Verify your API URL is correct:Default URL should be
https://app.harness.io. If using a custom endpoint:Corporate proxy or firewall
Corporate proxy or firewall
If behind a corporate proxy, ensure:
- HTTPS traffic to
*.harness.iois allowed - Proxy environment variables are set:
Timeout Errors
Symptom: Commands hang or timeout, especially during large operations like migrations. Solution:-
For registry migrations, adjust concurrency:
- Check network stability and latency to Harness endpoints
- For large artifact operations, consider splitting into smaller batches
Common Command Failures
Registry Not Found
Symptom: “not found” error when accessing a registry. Solution:Artifact Push Failures
Common Issues:File not found or invalid path
File not found or invalid path
Error: Operation failed on file pathSolution:
- Use absolute paths or ensure you’re in the correct directory
- Verify file permissions allow read access
- Check the file actually exists:
Invalid version format
Invalid version format
Error: Validation failed for version fieldSolution:
Different package types have different version requirements:
- Generic: Any string
- Maven: Follows Maven versioning (e.g.,
1.0.0-SNAPSHOT) - NPM: Follows semver (e.g.,
1.2.3) - Docker: Valid tag format
Package already exists
Package already exists
Error: Package version already existsSolution:
- Use the
--overwriteflag to replace existing versions (use with caution) - Increment the version number
- Delete the existing version first:
Configuration File Errors
Symptom: “Failed to load configuration” during migration. Solution:-
Validate your YAML syntax:
-
Ensure required fields are present:
- Source registry configuration
- Destination registry configuration
- Authentication credentials
-
Check file permissions allow read access:
See the Registry Migration guide for configuration examples.
Command Output Issues
JSON Output Parsing Errors
Symptom: Cannot parse JSON output or unexpected format. Solution:-
Ensure you’re using the
--format jsonflag: -
The default format is
tablefor human-readable output -
Pipe JSON output to
jqfor better parsing:
Empty or Unexpected Results
Issue: Commands return no results when you expect data. Debugging Steps:Build and Installation Issues
Building from Source Fails
Symptom:make build fails with compilation errors.
Requirements:
- Go 1.21 or later
- Required build tools installed
Install Go
Download and install Go from golang.org
Binary Not Found After Installation
Symptom:hc: command not found after installation.
Solution:
-
Verify the binary is in your PATH:
-
Check installation location:
-
Add installation directory to PATH:
-
Verify binary permissions:
Getting Help
If you’re still experiencing issues:Check Logs
Enable logging to diagnose issues:
GitHub Issues
Report bugs or request features at:
github.com/harness/harness-cli/issues
Community
Join the Harness community for support and discussions.
Documentation
Review the full command reference and guides.