{"record":{"id":"c5c50f714b5200dc","repo":"influxdata/influxdb","slug":"ca-certificate-pem-should-be-valid","errorCode":null,"errorMessage":"CA certificate PEM should be valid","messagePattern":"CA certificate PEM should be valid","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/client_util/src/connection.rs","lineNumber":187,"sourceCode":"            .connect_timeout(self.connect_timeout)\n            .timeout(self.timeout);\n        Ok(endpoint)\n    }\n\n    fn compose_middleware(self, channel: Channel, endpoint: Endpoint) -> Connection {\n        let headers_map: HeaderMap = self.headers.iter().cloned().collect();\n\n        // Compose channel with new tower middleware stack\n        let grpc_connection = tower::ServiceBuilder::new()\n            .layer(SetRequestHeadersLayer::new(self.headers))\n            .service(channel);\n\n        let mut http_builder = reqwest::Client::builder()\n            .connection_verbose(true)\n            .default_headers(headers_map);\n        if let Some(pem) = &self.ca_certificate_pem {\n            let cert =\n                reqwest::Certificate::from_pem(pem).expect(\"CA certificate PEM should be valid\");\n            http_builder = http_builder.add_root_certificate(cert);\n        }\n        let http_client = http_builder\n            .build()\n            .expect(\"reqwest::Client should have built\");\n\n        let http_connection = HttpConnection::new(endpoint.uri().clone(), http_client);\n\n        Connection::new(grpc_connection, http_connection)\n    }\n\n    /// Set the `User-Agent` header sent by this client.\n    pub fn user_agent(self, user_agent: impl Into<String>) -> Self {\n        Self {\n            user_agent: user_agent.into(),\n            ..self\n        }\n    }","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/client_util/src/connection.rs#L169-L205","documentation":"PluginError::MissingDb is thrown when the plugin execution environment has no database context at all — the code path expected a database handle to be present but it was None/absent. Unlike InvalidDatabase, the name isn't wrong; no database was supplied to the plugin runtime.","triggerScenarios":"Invoking a plugin through a code path that does not attach the line-protocol/write-buffer database (e.g. internal wiring bug, or calling a plugin helper that requires a db without one bound), typically from WAL/scheduled plugin execution where the db argument was not propagated.","commonSituations":"Server bug or unsupported trigger type invoking the plugin without db context; custom tooling calling the plugin API directly without supplying a database; version mismatch where a plugin expects a db argument the runner no longer passes.","solutions":["Check how the trigger was registered and ensure it targets a database (trigger definition includes a db).","Upgrade/align server version — this can indicate an internal wiring invariant violation; report if reproducible.","If calling plugin APIs directly, pass the database explicitly.","Verify the trigger's `--database` option was set when it was created."],"exampleFix":"// before\ninfluxdb3 trigger create --trigger-spec cron:... my_trig plugin.py\n// after\ninfluxdb3 trigger create --database metrics --trigger-spec cron:... my_trig plugin.py","handlingStrategy":"validation","validationCode":"# ensure every trigger is bound to a database\ninfluxdb3 show triggers | awk '$NF==\"\"{print \"trigger without database!\"}'","typeGuard":"fn has_db_context(ctx: &PluginContext) -> bool { ctx.db().is_some() }","tryCatchPattern":"match result {\n    Err(PluginError::MissingDb) => { error!(\"plugin ran without db context; check trigger creation flags and server version\"); }\n    Ok(v) => v,\n}","preventionTips":["Always pass --database when creating triggers.","Pin compatible server versions; report MissingDb as a bug if reproducible.","Supply the db explicitly when invoking plugin APIs from tooling."],"tags":["plugin","python","database","missing-context"],"backgroundTag":"missing-required-argument","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"}