influxdata/influxdb · error

CA certificate PEM should be valid

Error message

CA certificate PEM should be valid

What it means

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.

Solutions

  1. Check how the trigger was registered and ensure it targets a database (trigger definition includes a db).
  2. Upgrade/align server version — this can indicate an internal wiring invariant violation; report if reproducible.
  3. If calling plugin APIs directly, pass the database explicitly.
  4. Verify the trigger's `--database` option was set when it was created.

Example fix

// before
influxdb3 trigger create --trigger-spec cron:... my_trig plugin.py
// after
influxdb3 trigger create --database metrics --trigger-spec cron:... my_trig plugin.py
Defensive patterns

Strategy: validation

Validate before calling

# ensure every trigger is bound to a database
influxdb3 show triggers | awk '$NF==""{print "trigger without database!"}'

Type guard

fn has_db_context(ctx: &PluginContext) -> bool { ctx.db().is_some() }

Try / catch

match result {
    Err(PluginError::MissingDb) => { error!("plugin ran without db context; check trigger creation flags and server version"); }
    Ok(v) => v,
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

            .connect_timeout(self.connect_timeout)
            .timeout(self.timeout);
        Ok(endpoint)
    }

    fn compose_middleware(self, channel: Channel, endpoint: Endpoint) -> Connection {
        let headers_map: HeaderMap = self.headers.iter().cloned().collect();

        // Compose channel with new tower middleware stack
        let grpc_connection = tower::ServiceBuilder::new()
            .layer(SetRequestHeadersLayer::new(self.headers))
            .service(channel);

        let mut http_builder = reqwest::Client::builder()
            .connection_verbose(true)
            .default_headers(headers_map);
        if let Some(pem) = &self.ca_certificate_pem {
            let cert =
                reqwest::Certificate::from_pem(pem).expect("CA certificate PEM should be valid");
            http_builder = http_builder.add_root_certificate(cert);
        }
        let http_client = http_builder
            .build()
            .expect("reqwest::Client should have built");

        let http_connection = HttpConnection::new(endpoint.uri().clone(), http_client);

        Connection::new(grpc_connection, http_connection)
    }

    /// Set the `User-Agent` header sent by this client.
    pub fn user_agent(self, user_agent: impl Into<String>) -> Self {
        Self {
            user_agent: user_agent.into(),
            ..self
        }
    }

View on GitHub (pinned to 06200ef96b)