{"record":{"id":"c2f73e497d7e9415","repo":"influxdata/influxdb","slug":"invalid-uri","errorCode":null,"errorMessage":"Invalid URI: {}","messagePattern":"Invalid URI: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"core/client_util/src/connection.rs","lineNumber":88,"sourceCode":"/// The default connection timeout\npub const DEFAULT_CONNECT_TIMEOUT: Duration = Duration::from_secs(1);\n/// The default request timeout\npub const DEFAULT_TIMEOUT: Duration = Duration::from_secs(30);\n\n/// Errors returned by the ConnectionBuilder\n#[derive(Debug, Error)]\npub enum Error {\n    /// Server returned an invalid argument error\n    #[error(\"Connection error: {}{}\", source, details)]\n    TransportError {\n        /// underlying [`tonic::transport::Error`]\n        source: tonic::transport::Error,\n        /// stringified version of the tonic error's source\n        details: String,\n    },\n\n    /// Client received an unexpected error from the server\n    #[error(\"Invalid URI: {}\", .0)]\n    InvalidUri(#[from] http::Error),\n}\n\n// Custom impl to include underlying source (not included in tonic\n// transport error)\nimpl From<tonic::transport::Error> for Error {\n    fn from(source: tonic::transport::Error) -> Self {\n        use std::error::Error;\n        let details = source\n            .source()\n            .map(|e| format!(\" ({e})\"))\n            .unwrap_or_default();\n\n        Self::TransportError { source, details }\n    }\n}\n\n/// Result type for the ConnectionBuilder","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/client_util/src/connection.rs#L70-L106","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Print/verify the exact database name and compare against `SHOW DATABASES`.","Fix the hardcoded or parameterized db name in the plugin code.","Create the missing database if it is genuinely intended.","Strip whitespace and match case of the database identifier."],"exampleFix":"// before (plugin.py)\ndb = query(\"SELECT * FROM 'metrics'\")  # uses invalid db name from trigger config\n// after\ndb = query(\"SELECT * FROM 'metrics'\", database=\"metrics_prod\")  # name verified via SHOW DATABASES","handlingStrategy":"validation","validationCode":"# resolve and verify the db name before the trigger runs\ninfluxdb3 show databases | grep -x \"$DB_NAME\" || echo \"database '$DB_NAME' does not exist\"","typeGuard":"fn db_exists(catalog: &Catalog, name: &str) -> bool { !name.trim().is_empty() && catalog.db_exists(name) }","tryCatchPattern":"try:\n    db = query(sql, database=DB_NAME)\nexcept Exception as e:\n    if 'invalid database' in str(e):\n        raise RuntimeError(f\"check DB_NAME={DB_NAME!r} against SHOW DATABASES\") from e\n    raise","preventionTips":["Inject the database name from trigger config instead of hardcoding it.","Trim whitespace and verify case in database names.","Re-validate plugin configs after renaming/dropping databases."],"tags":["plugin","python","database","invalid-name"],"backgroundTag":"invalid-argument-value","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}