Common issues and solutions for ghx-cli.
Error: no authentication token available
Cause: ghx-cli cannot find a valid GitHub token.
Solutions:
-
Login with GitHub CLI:
gh auth login
-
Set environment variable:
export GITHUB_TOKEN="ghp_your_token"
-
Add to config file (
~/.ghx.yaml):token: "ghp_your_token"
Error: Bad credentials
Cause: The token is invalid, expired, or revoked.
Solutions:
-
Refresh GitHub CLI authentication:
gh auth refresh
-
Generate a new token at GitHub Settings
-
Check token validity:
ghx auth status
Error: Resource not accessible by integration
Cause: Token lacks required permissions.
Required scopes:
repo- Repository accessproject- Projects accesswrite:discussion- Discussion write access
Solutions:
-
Add scopes via GitHub CLI:
gh auth refresh -s repo,project
-
Generate new token with required scopes
Error: API rate limit exceeded
Cause: Too many API requests in a short time.
Solutions:
-
Wait for rate limit reset (usually 1 hour)
-
Check current rate limit:
gh api rate_limit
-
Use caching to reduce requests:
# Ensure caching is enabled ghx project list # Cached after first request
Error: Could not resolve to a Project
Cause: Project or resource doesn't exist or is not accessible.
Solutions:
-
Verify the project reference:
# Correct format: owner/number ghx project view myorg/123 -
Check access permissions
-
Verify the project exists:
gh project list --owner myorg
Error: GraphQL error: Field 'xxx' doesn't exist
Cause: API schema mismatch, usually due to GitHub API changes.
Solutions:
-
Update ghx-cli to latest version:
go install github.com/roboco-io/ghx-cli/cmd/ghx@latest
-
Report the issue on GitHub Issues
Error: invalid repository format: expected owner/repo
Cause: Repository reference is not in correct format.
Solution: Use owner/repo format:
# Correct
ghx discussion list myorg/my-repo
# Incorrect
ghx discussion list my-repo
ghx discussion list myorg/my-repo/issuesError: invalid project reference
Cause: Project reference is not in correct format.
Solution: Use owner/number or project ID:
# By owner/number
ghx project view myorg/123
# By project ID
ghx project view PVT_kwDOBcH12s4AXxyzError: required flag "category" not set
Cause: A required flag was not provided.
Solution: Add the required flag:
ghx discussion create myorg/repo --category general --title "Title"Cause: Command succeeded but returned no results.
Solutions:
-
Check if resources exist:
ghx project list --format json
-
Try different filters:
ghx discussion list myorg/repo --state all
-
Enable debug mode:
ghx project list --debug
Error: invalid character in JSON
Cause: Output contains non-JSON content.
Solutions:
-
Check for debug output mixed with JSON:
# Disable debug when piping ghx project list --format json 2>/dev/null | jq .
-
Redirect stderr:
ghx project list --format json 2>&1 | jq .
Cause: Large data sets or disabled caching.
Solutions:
-
Enable caching (default):
# Ensure --no-cache is not set ghx project list -
Use limits:
ghx item list myorg/repo --limit 20
-
Use filters:
ghx discussion list myorg/repo --state open --limit 10
Cause: Processing large projects with many items.
Solutions:
-
Use pagination:
ghx item list myorg/repo --limit 100
-
Export in chunks:
ghx analytics export myorg/123 --items-only
Error: cannot find package
Solutions:
-
Update Go modules:
go mod tidy
-
Clear module cache:
go clean -modcache go mod download
-
Ensure Go version 1.21+:
go version
FAIL: TestXxx
Solutions:
-
Run with verbose output:
go test -v ./... -
Run specific test:
go test -v -run TestXxx ./internal/service/... -
Skip integration tests:
go test -short ./...
If your issue isn't covered here:
-
Check debug output:
ghx <command> --debug
-
Search existing issues: GitHub Issues
-
Ask in discussions: GitHub Discussions
-
Report a bug: New Issue
When reporting issues, include:
- ghx-cli version (
ghx --version) - Go version (
go version) - OS and architecture
- Full error message
- Steps to reproduce