Troubleshoot CockroachDB data source issues
This document provides solutions to common issues you might encounter when configuring or using the CockroachDB data source. For configuration instructions, refer to Configure the CockroachDB data source.
Connection errors
These errors occur when Grafana can’t establish or maintain a connection to your CockroachDB instance.
“ping failed” or “connection refused”
Symptoms:
- Save & test fails with
connection validation failed: ping failed: connection refused.
Possible causes and solutions:
“connection validation timed out after 30s”
Symptoms:
- Save & test hangs and then fails with a timeout error.
Solutions:
- Verify network connectivity between the Grafana server and CockroachDB.
- Check for firewall rules that might be silently dropping connections.
- If connecting across regions or through a VPN, check network latency.
- For Grafana Cloud, configure Private data source connect if accessing a private CockroachDB instance.
“test query timed out after 30s”
Symptoms:
- Save & test passes the ping but fails with a query timeout.
Solutions:
- The plugin runs
SELECT 1to verify the connection is fully functional. If this times out, CockroachDB might be under heavy load. - Check CockroachDB cluster health and node availability.
- Verify the configured user has permission to execute queries on the target database.
“test query returned unexpected result”
Symptoms:
- Save & test fails after successfully connecting and running a test query.
Solutions:
- This indicates the
SELECT 1health check query returned an unexpected value. This is rare and typically indicates a CockroachDB proxy or load balancer is intercepting queries. - Verify you’re connecting directly to CockroachDB and not through a query-rewriting proxy.
“connection string is invalid”
Symptoms:
- Save & test fails immediately with a connection string error.
Solutions:
- Verify the Host URL format includes the port (for example,
myhost:26257). - Check that the Database name is correct and doesn’t contain invalid characters.
- Ensure the username doesn’t contain unescaped special characters.
“unable to parse connection string” or “unable to generate a connection string”
Symptoms:
- Save & test fails with a connection string parsing error.
Possible causes and solutions:
“invalid port in host specifier”
Symptoms:
- Save & test fails with a port parsing error.
Solutions:
- Verify the port in your Host URL is a valid number (for example,
26257). - Check there are no extra characters after the port number.
- If using an IPv6 address, use the format
[::1]:26257.
“invalid URL format: missing port in …”
Symptoms:
- Save & test fails when using Kerberos or TLS/SSL authentication.
Solutions:
- The Host URL must include a port number. Add the port to your URL (for example, change
myhosttomyhost:26257).
“failed to configure database connection”
Symptoms:
- Save & test fails after the connection string is generated but before the connection is validated.
Solutions:
- Review the connection pool settings (Max open connections, Max idle connections, Max connection lifetime) for invalid values.
- Check Grafana server logs for the underlying error message.
“cockroach proxy creation failed”
Symptoms:
- Save & test fails when using a secure socks proxy.
Solutions:
- Verify the secure socks proxy configuration in Grafana.
- Ensure the proxy server is running and reachable from the Grafana server.
- Check that the proxy supports the required protocol for CockroachDB connections.
Authentication errors
These errors occur when credentials are invalid or missing.
“invalid username”
Symptoms:
- Save & test fails with a validation error before attempting to connect.
Solutions:
- Ensure the User field isn’t empty.
- Verify the username matches a valid CockroachDB user. Run
SHOW USERSin a CockroachDB SQL shell to confirm.
“invalid password”
Symptoms:
- Save & test fails with a validation error before attempting to connect.
Solutions:
- Ensure the Password field isn’t empty (required for SQL and TLS/SSL authentication).
- Verify the password is correct for the configured user.
- If using Kerberos authentication, this error shouldn’t occur because Kerberos doesn’t require a password field.
“invalid Host URL”
Symptoms:
- Save & test fails with a validation error.
Solutions:
- Ensure the Host URL field isn’t empty.
- Verify the URL includes the host and port (for example,
localhost:26257).
“invalid database”
Symptoms:
- Save & test fails with a validation error.
Solutions:
- Ensure the Database field isn’t empty.
- Verify the database exists in CockroachDB by running
SHOW DATABASESin a SQL shell.
Kerberos errors
These errors are specific to Kerberos authentication. Kerberos requires an Enterprise CockroachDB license.
“kerberos error (InitSecContext)”
Symptoms:
- Save & test fails during the Kerberos security context initialization.
Possible causes and solutions:
“kerberos error (Marshaling token)” or “kerberos error when attempting to unmarshal token”
Symptoms:
- Save & test fails during Kerberos token exchange.
Solutions:
- This typically indicates a protocol mismatch between the Kerberos client and server.
- Verify the Kerberos library versions are compatible.
- Check the KDC logs for related errors.
“kerberos: expected state ‘Completed’”
Symptoms:
- Kerberos authentication starts but doesn’t complete the negotiation.
Solutions:
- Verify the service principal is correctly configured in the KDC.
- Check that mutual authentication is properly set up.
- Review KDC logs for authentication failures or policy violations.
Credential cache load failure
Symptoms:
- Save & test fails when loading the Kerberos credential cache.
- Error references the credential cache file path.
Possible causes and solutions:
krb5 configuration load failure
Symptoms:
- Save & test fails before Kerberos authentication starts.
- Error references the krb5 config file.
Solutions:
- Verify the krb5 configuration file exists at the configured path (default:
/etc/krb5.conf). - If the
KRB5_CONFIGenvironment variable is set, it overrides the default path. Verify the file it points to exists. - Check the file is a valid krb5 configuration format.
Kerberos login failure
Symptoms:
- Kerberos credential loading succeeds but login fails.
Solutions:
- Verify the Kerberos principal is valid and active in the KDC.
- Check that the credential cache contains a valid, non-expired TGT (ticket-granting ticket).
- Run
klistto verify the cached tickets are current. - Renew credentials with
kinitif tickets are expired.
TLS/SSL errors
These errors occur when certificate configuration is incorrect.
“missing or invalid root cert path” or “missing or invalid root cert content”
Symptoms:
- Save & test fails with a root certificate error.
Possible causes and solutions:
“missing or invalid client cert path” or “missing or invalid client cert content”
Symptoms:
- Save & test fails with a client certificate error.
Solutions:
- Ensure the client certificate path or content is provided.
- Verify the TLS/SSL method matches how you’re providing the certificate (
file-pathorfile-content). - If using
file-path, verify the file exists and is readable by the Grafana process.
“missing or invalid client key path” or “missing or invalid client key content”
Symptoms:
- Save & test fails with a client key error.
Solutions:
- Ensure the client key path or content is provided.
- Verify the TLS/SSL method matches how you’re providing the key (
file-pathorfile-content). - If using
file-path, verify the file exists and is readable by the Grafana process.
“failure to append root cert”
Symptoms:
- Connection fails after certificates are loaded.
Solutions:
- Verify the root certificate is a valid PEM-encoded CA certificate.
- Ensure the root certificate matches the CA that signed the CockroachDB server certificate.
- Check that the certificate file isn’t corrupted or truncated.
“unable to read root certificate”
Symptoms:
- TLS connection fails when loading the CA certificate file.
Possible causes and solutions:
“unable to load client certificate and key”
Symptoms:
- TLS connection fails when loading the client certificate and key pair.
Possible causes and solutions:
“error generating TLS config”
Symptoms:
- Save & test fails with a TLS configuration error that wraps one of the errors in this section.
Solutions:
- Check the full error message for the underlying cause (for example, missing certs, invalid paths, or permission issues).
- Review the TLS/SSL configuration settings and verify all required fields are populated.
TLS certificate file write errors
Symptoms:
- When using
file-contentmode, the plugin fails to write temporary certificate files.
Solutions:
- Verify the Grafana data directory is writable by the Grafana process.
- Check available disk space on the Grafana server.
- Ensure no file system permissions prevent writing to the
tls/subdirectory of the Grafana data path.
Query errors
These errors occur when running queries against CockroachDB.
Query timeout
Symptoms:
- Queries run for a long time and then fail with a timeout error.
Solutions:
- Narrow the dashboard time range to reduce the amount of data queried.
- Add filters to your query to reduce the result set.
- Increase the Query timeout in the data source settings (range: 5-600 seconds, default: 30 seconds).
- Optimize your CockroachDB query by adding indexes or simplifying joins.
“test query failed”
Symptoms:
- Save & test passes the ping but fails on the test query.
Solutions:
- Verify the configured user has
SELECTpermission on the target database. - Verify the configured database exists and is accessible.
- Check CockroachDB logs for query-level errors.
Intermittent “connection reset”, “broken pipe”, or “EOF” errors
Symptoms:
- Queries fail intermittently with connection errors.
- Errors resolve on retry.
Solutions:
- These errors are automatically retried by the plugin (up to 3 retries with 1-second pauses).
- If they persist, check the CockroachDB cluster health and node availability.
- Consider reducing Max connection lifetime to prevent stale connections.
- If CockroachDB is performing cluster operations (node restarts, rebalancing), transient errors are expected and retries should handle them.
Macro errors: “expected 1 argument for timeFilter”
Symptoms:
- Query fails with an error about incorrect macro arguments.
Solutions:
- Verify the macro syntax. Each macro requires exactly one argument (the column name):
- Correct:
$__timeFilter(created_at) - Incorrect:
$__timeFilter(created_at, other_col) - Incorrect:
$__timeFilter()
- Correct:
- Check for extra commas or spaces inside the macro parentheses.
“No data” or empty results
Symptoms:
- Query executes without error but panels show “No data”.
- Query works in Explore but not in a dashboard panel.
Possible causes and solutions:
Query returns wrong data type
Symptoms:
- Panel shows unexpected values or formatting.
- Numbers appear as strings or timestamps don’t parse correctly.
Solutions:
- Use explicit type casts in your SQL query (for example,
CAST(value AS FLOAT)orvalue::float). - Ensure timestamp columns use a CockroachDB timestamp type (
TIMESTAMP,TIMESTAMPTZ), not a string. - For numeric panels, verify the query returns numeric types, not strings.
Template variable errors
These issues occur when using template variables with the CockroachDB data source.
Variables return no values
Symptoms:
- Variable drop-down is empty.
- Dashboard shows “No data” for variable-dependent panels.
Solutions:
- Verify the data source connection is working by running Save & test in the data source settings.
- Test the variable query directly in Explore to confirm it returns results.
- For cascading variables, verify parent variables have valid selections. If a parent variable is empty, dependent variables can’t populate.
- Check that the CockroachDB user has
SELECTpermission on the tables referenced in the variable query.
Variables are slow to load
Symptoms:
- Dashboard takes a long time to load.
- Variable drop-down menus are slow to populate.
Solutions:
- Set the variable Refresh option to On dashboard load instead of On time range change if the variable values don’t depend on the time range.
- Add a
LIMITto your variable query if it returns many rows. - Avoid using
SELECT DISTINCTon large tables without an index on the column. - Consider caching variable results by using a custom variable with pre-defined values for stable data.
Performance issues
These issues relate to slow dashboards or high resource consumption.
Dashboard panels load slowly
Symptoms:
- Panels take a long time to render.
- Multiple panels time out simultaneously.
Solutions:
- Reduce the dashboard time range to limit the data scanned.
- Add
WHEREclauses and filters to narrow result sets. - Use
date_truncwith larger intervals (for example,'hour'instead of'minute') for long time ranges. - Add indexes in CockroachDB for frequently queried columns, especially timestamp columns used with
$__timeFilter. - Review the Query timeout and Max open connections settings. Too many concurrent queries with a low connection limit can cause queuing.
CockroachDB cluster impact
Symptoms:
- Grafana queries cause noticeable load on the CockroachDB cluster.
- Other applications experience slowdowns when dashboards are open.
Solutions:
- Avoid
SELECT *– select only the columns you need. - Reduce dashboard auto-refresh frequency. A 30-second refresh on a dashboard with 10 panels generates significant query load.
- Use a read replica or follower read if your CockroachDB deployment supports it.
- Enable query caching in Grafana (available in Grafana Enterprise and Grafana Cloud).
Plugin errors
These errors relate to the plugin itself rather than the CockroachDB connection.
Plugin not found or failed to load
Symptoms:
- CockroachDB doesn’t appear in the data source list.
- Error message about a missing or unsigned plugin.
Solutions:
- Verify the plugin is installed. Navigate to Plugins and data > Plugins and search for “CockroachDB”.
- The CockroachDB data source is an Enterprise plugin. Verify you have a Grafana Cloud Pro or Advanced plan or an activated Grafana Enterprise license.
- If self-hosting, verify the plugin binary is in the Grafana plugins directory and the Grafana process has execute permissions.
- Restart Grafana after installing or updating the plugin.
Enable debug logging
To capture detailed error information, enable debug-level logging in Grafana. The process differs between self-hosted and Grafana Cloud environments.
Self-hosted Grafana
Set the Grafana log level to
debugin the configuration file:[log] level = debugRestart Grafana for the change to take effect.
Review logs in
/var/log/grafana/grafana.log(or your configured log location).Look for entries containing
CockroachDBfor plugin-specific messages.Reset the log level to
infoafter troubleshooting to avoid excessive log volume.
Grafana Cloud
- Navigate to Administration > General.
- Under Log level, select Debug.
- Reproduce the issue and review logs in the Explore section using the built-in Grafana logs data source.
- Reset the log level to Info after troubleshooting.
Get additional help
If the solutions in this document don’t resolve your issue:
- Check the Grafana community forums for similar issues.
- Consult the CockroachDB documentation for service-specific guidance.
- Contact Grafana Support if you’re an Enterprise, Cloud Pro, or Cloud Contracted user.
When reporting issues, include:
- Grafana version and CockroachDB plugin version.
- Error messages (redact sensitive information).
- Steps to reproduce the issue.
- Relevant configuration (redact credentials).



