grafana-util docs

Troubleshooting & Glossary

Use this chapter when a command looks syntactically correct but the result is wrong, incomplete, or inconsistent with what you expected.

Who It Is For

  • Operators who can run the command, but do not trust the outcome yet.
  • Engineers trying to separate auth, scope, staged-input, and live-state problems.
  • Teams building a repeatable debugging flow instead of ad hoc trial and error.

Primary Goals

  • Identify the category of failure before changing credentials or inputs.
  • Point you to the right companion chapter or command reference quickly.
  • Keep debugging focused on facts you can verify from the CLI.

Before / After

  • Before: people had to guess whether a bad result was a syntax problem, a scope problem, or a workflow problem.
  • After: the troubleshooting chapter separates connection, scope, staged input, and output-shape problems into readable checks.

What success looks like

  • You can identify the likely failure class before reading every command page.
  • You can decide whether to fix auth, scope, staged input, or output formatting.
  • You can tell when the problem belongs in the workflow chapter instead of here.

Failure checks

  • If the symptom is still unclear after the first check, do not continue mutating live state.
  • If a command syntax error hides the real problem, verify the selected lane and auth source before changing anything else.
  • If the output shape is surprising but the command exits cleanly, check the documented contract before assuming the renderer is wrong.

It helps you diagnose real failures instead of guessing. The most useful split is not just "error code versus no error code", but:

  • auth versus scope
  • live versus staged
  • command shape versus output shape
  • local profile wiring versus remote Grafana behavior

If you are tracing auth or connection setup, keep profile, status, overview, and access open beside this chapter.

Debugging the CLI

When a command fails or behaves unexpectedly, use these techniques to look under the hood.

1. Enable verbose logging

grafana-util uses standard Rust logging. You can increase verbosity to see the exact API requests and responses.

# Purpose: grafana-util uses standard Rust logging. You can increase verbosity to see the exact API requests and responses.
RUST_LOG=debug grafana-util overview live --profile prod
grafana-util dashboard list -v

Use this when you need to answer:

  • did the CLI call the host you expected?
  • was the request rejected by auth, scope, or network?
  • did the command shape differ from what the docs led you to expect?

2. Common errors and fast fixes

SymptomProbable CauseFix
401 UnauthorizedInvalid token or user/passwordCheck your profile or environment variables
403 ForbiddenCredential is valid but lacks required scopeVerify role/permissions or retry with broader admin credentials
Connection RefusedWrong URL or firewall/network blockVerify --url and network reachability to Grafana
TimeoutLarge estate or slow backendIncrease --timeout and retry with a narrower scope first

3. Scope and auth mismatches

These are some of the most confusing failures because the command may "work" but still return incomplete or misleading results.

SymptomLikely CauseWhat to check next
--all-orgs returns fewer orgs than expectedtoken scope is narrower than the requested readretry with an admin-backed profile or direct Basic auth
read-only status works but access/admin commands failcredential is valid, but not broad enoughcompare the scope of the current credential with the command family you are calling
token works in one job but fails in anotherthe second job is using a broader surface than the token was meant forcheck whether the workflow should be profile-backed Basic auth instead

Rule of thumb:

  • auth success does not automatically imply scope success
  • if the output looks suspiciously partial, suspect scope before suspecting parsing

4. Staged vs live confusion

This is one of the most common operator mistakes.

SymptomWhat is really happeningFix
status staged looks healthy but live apply still failsstaged files are structurally valid, but live state or permissions differrun status live, then change check, change preview, or command-specific dry-run paths
overview live looks good so you skip change reviewlive readability is not the same as staged correctnessrun the staged gate and preview path before apply
import or apply changes more than expectedthe staged package was never inspected or previewed firstuse change inspect, change preview, and --dry-run before execution

5. Secret and profile problems

SymptomLikely CauseFix
profile show --show-secrets fails to resolve a valuemissing env var, missing OS-store entry, or missing encrypted secret file/keyverify the secret source that the profile points to
profile works locally but not in CIenv injection or config path differs between environmentscheck GRAFANA_UTIL_CONFIG, env vars, and any required secret files
--store-secret os works on macOS but not LinuxLinux runner may not have a working Secret Service sessionswitch to password_env, token_env, or encrypted-file

6. Output-mode mistakes

SymptomLikely CauseFix
parser in CI breaks unexpectedlya human-oriented output mode was usedprefer json, yaml, or another machine-readable mode
a command rejects one --output-format valuethat command only supports a narrower set of formatscheck the current command help or command-reference page
interactive output is confusing in a first-run checktoo much presentation, not enough raw signalswitch to yaml or json first

Glossary of Terms

TermDefinition
SurfaceA high-level interface category such as Status, Overview, or Change
LaneAn isolated data path for assets such as raw/, prompt/, or provisioning/
ContractA machine-readable JSON document that defines a readiness or compatibility expectation
Masked RecoveryExporting secrets in masked form, then re-injecting them during import/replay
Desired StateThe goal configuration stored in Git that the CLI compares against live Grafana
DriftThe gap between live Grafana configuration and the local staged or desired artifacts

Getting More Help

  • Check the version: always run grafana-util --version when reporting issues.
  • Project repository: report bugs or request features on the GitHub Issues page.

When escalating an issue, include:

  • the exact command
  • whether the command was live or staged
  • whether you used --profile, direct Basic auth, or token auth
  • whether the failure looked like syntax, connectivity, scope, or staged-input shape

⬅️ Previous: Best Practices & Recipes | 🏠 Home