t8y2/dbx · error
connection runtime is not initialized
Error message
connection runtime is not initialized
What it means
connectionRuntime.queryListTables returns this when the runtime's prepared listTables statement is absent AND its validator *sql.DB is nil — i.e. the connection runtime was never initialized (or already shut down after the grace period). Raised in the cachedListTablesQuery path.
Source
Thrown at agents/drivers/vastbase-go/runtime_pool.go:144
if validator == nil {
return nil
}
return validator.Close()
}
func (connectionRuntime *connectionRuntime) database() *sql.DB {
connectionRuntime.mu.Lock()
defer connectionRuntime.mu.Unlock()
return connectionRuntime.validator
}
func (connectionRuntime *connectionRuntime) queryListTables(query, schema string) (*sql.Rows, error) {
connectionRuntime.mu.Lock()
statement := connectionRuntime.listTablesStatement
if statement == nil {
if connectionRuntime.validator == nil {
connectionRuntime.mu.Unlock()
return nil, errors.New("connection runtime is not initialized")
}
prepared, err := connectionRuntime.validator.Prepare(query)
if err != nil {
connectionRuntime.mu.Unlock()
return nil, err
}
connectionRuntime.listTablesStatement = prepared
statement = prepared
}
connectionRuntime.mu.Unlock()
return statement.Query(schema)
}
func (s *server) acquireOperationPermit(method string) (func(), error) {
if s.connectionRuntime == nil {
return func() {}, nil
}
metadata := isMetadataOperation(method) || strings.EqualFold(strings.TrimSpace(s.params.SessionRole), "metadata")View on GitHub (pinned to c0390bff16)
Solutions
- Reconnect/reinitialize the connection runtime (trigger the agent's connect path) before listing tables
- Check that the runtime's validator DB was successfully opened at startup
- Guard client code against issuing table-list calls during agent shutdown windows
Example fix
// before
rows, err := agent.ListTables(ctx, schema) // runtime may be uninitialized
// after
if err := agent.EnsureRuntimeInitialized(ctx); err != nil { return err }
rows, err := agent.ListTables(ctx, schema) Defensive patterns
Strategy: fallback
Validate before calling
if runtime == nil || runtime.Validator() == nil { return errors.New("runtime not ready; reconnect") } Type guard
func runtimeReady(rt *connectionRuntime) bool { rt.mu.Lock(); defer rt.mu.Unlock(); return rt.validator != nil } Try / catch
rows, err := cachedListTablesQuery(q, schema)
if err != nil && strings.Contains(err.Error(), "not initialized") {
if ierr := initRuntime(ctx); ierr != nil { return ierr }
rows, err = cachedListTablesQuery(q, schema)
} Prevention
- Initialize the runtime during connect before serving list-tables requests
- Re-init after grace-period shutdown; do not serve from a torn-down runtime
- Add readiness probes so requests wait for warm-up
When it happens
Trigger: cachedListTablesQuery -> queryListTables before the runtime's initialize/prepare ran; after runtime shutdown closed the validator and cleared listTablesStatement; a race where a table-list request lands during teardown.
Common situations: Requesting table lists during agent startup before the runtime warms up; requesting after connectionRuntimeGracePeriod (30s) expired and the runtime was torn down; a closed DB connection while cached metadata is still referenced.
Related errors
- JDBC pool registry must be attached before connecting
- Not connected
- JDBC connection pool registry is closed
- No active JDBC checkout owns physical connection creation
- Agent session is quarantined
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/0fcaad5cacf9034e.
Report an issue: GitHub.