influxdata/influxdb · error · Error

Invalid URI

Error message

Invalid URI: {}

What it means

PluginError::InvalidDatabase is raised when a plugin execution context is given a database name that the server does not recognize. The string payload carries the offending database name. It guards plugin code against writing/reading through an invalid or nonexistent database handle.

Solutions

  1. Print/verify the exact database name and compare against `SHOW DATABASES`.
  2. Fix the hardcoded or parameterized db name in the plugin code.
  3. Create the missing database if it is genuinely intended.
  4. Strip whitespace and match case of the database identifier.

Example fix

// before (plugin.py)
db = query("SELECT * FROM 'metrics'")  # uses invalid db name from trigger config
// after
db = query("SELECT * FROM 'metrics'", database="metrics_prod")  # name verified via SHOW DATABASES
Defensive patterns

Strategy: validation

Validate before calling

# resolve and verify the db name before the trigger runs
influxdb3 show databases | grep -x "$DB_NAME" || echo "database '$DB_NAME' does not exist"

Type guard

fn db_exists(catalog: &Catalog, name: &str) -> bool { !name.trim().is_empty() && catalog.db_exists(name) }

Try / catch

try:
    db = query(sql, database=DB_NAME)
except Exception as e:
    if 'invalid database' in str(e):
        raise RuntimeError(f"check DB_NAME={DB_NAME!r} against SHOW DATABASES") from e
    raise

Prevention

When it happens

Trigger: A Python plugin (WAL, scheduled, or request trigger) that resolves a database by name (e.g. via the influxdb3_python_api query/write helpers) with a name not present in the catalog, or code that passes a wrong/empty database string into the plugin runtime.

Common situations: Hardcoded database name in a plugin script that doesn't match the deployed database; database renamed or dropped; leading/trailing whitespace or case mismatch in the name.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/c2f73e497d7e9415. Report an issue: GitHub.

Appendix: source

Thrown at core/client_util/src/connection.rs:88

/// The default connection timeout
pub const DEFAULT_CONNECT_TIMEOUT: Duration = Duration::from_secs(1);
/// The default request timeout
pub const DEFAULT_TIMEOUT: Duration = Duration::from_secs(30);

/// Errors returned by the ConnectionBuilder
#[derive(Debug, Error)]
pub enum Error {
    /// Server returned an invalid argument error
    #[error("Connection error: {}{}", source, details)]
    TransportError {
        /// underlying [`tonic::transport::Error`]
        source: tonic::transport::Error,
        /// stringified version of the tonic error's source
        details: String,
    },

    /// Client received an unexpected error from the server
    #[error("Invalid URI: {}", .0)]
    InvalidUri(#[from] http::Error),
}

// Custom impl to include underlying source (not included in tonic
// transport error)
impl From<tonic::transport::Error> for Error {
    fn from(source: tonic::transport::Error) -> Self {
        use std::error::Error;
        let details = source
            .source()
            .map(|e| format!(" ({e})"))
            .unwrap_or_default();

        Self::TransportError { source, details }
    }
}

/// Result type for the ConnectionBuilder

View on GitHub (pinned to 06200ef96b)