{"record":{"id":"cc218f780225755f","repo":"jaegertracing/jaeger","slug":"failed-to-initialize-storage-s-w","errorCode":null,"errorMessage":"failed to initialize storage '%s': %w","messagePattern":"failed to initialize storage '(.+?)': %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/internal/storageconfig/factory.go","lineNumber":87,"sourceCode":"\t\t}\n\t\tfactory, err = es.NewFactory(ctx, *backend.Elasticsearch, telset, httpAuth)\n\tcase backend.Opensearch != nil:\n\t\tvar httpAuth extensionauth.HTTPClient\n\t\tif authResolver != nil {\n\t\t\thttpAuth, err = authResolver(backend.Opensearch.Authentication, \"opensearch\", name)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tfactory, err = es.NewFactory(ctx, *backend.Opensearch, telset, httpAuth)\n\tcase backend.ClickHouse != nil:\n\t\tfactory, err = clickhouse.NewFactory(ctx, *backend.ClickHouse, telset)\n\tdefault:\n\t\terr = errors.New(\"empty configuration\")\n\t}\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to initialize storage '%s': %w\", name, err)\n\t}\n\n\treturn factory, nil\n}\n","sourceCodeStart":69,"sourceCodeEnd":92,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/cmd/internal/storageconfig/factory.go#L69-L92","documentation":"CreateTraceStorageFactory builds a storage.Factory for a named trace backend using the configured type (memory, badger, cassandra, elasticsearch/opensearch, grpc, clickhouse). When the type-specific constructor returns an error — connection refused, bad credentials, invalid options, or an 'empty configuration' fallback for an unknown type — it is wrapped as `failed to initialize storage '%s': %w` naming the backend.","triggerScenarios":"Calling CreateTraceStorageFactory(ctx, name, backend, telset) where the constructor for the configured backend type fails: Cassandra/Elasticsearch/ClickHouse unreachable or with bad auth, gRPC remote-storage address unresolvable, or backend struct with no type set (hits the default 'empty configuration' branch).","commonSituations":"Database not up yet or wrong hostname/port in the backend config; wrong username/password or TLS settings for Elasticsearch/Cassandra; keyspace/index templates missing; named backend entry whose type field is missing so the default branch triggers; storage plugin dependency versions mismatched.","solutions":["Read the wrapped cause after 'failed to initialize storage NAME' — it names the real failure (connection refused, auth failed, empty configuration, etc.)","If the cause is 'empty configuration', the named backend has no recognized type field set — add exactly one storage type to that entry","Verify connectivity from the Jaeger host to the storage backend (host, port, TLS) and fix credentials in the backend config","For Cassandra/Elasticsearch, ensure the schema/keyspace/index was initialized (e.g. jaeger-cassandra-schema / index templates) before starting","Order deployment so the storage service is ready before Jaeger starts, or add retry/readiness gating"],"exampleFix":"// before (config.yaml)\njaeger:\n  storage:\n    trace_backends:\n      main:\n        elasticsearch:\n          servers: http://es:9200\n          index_prefix: \"\"   # ok\n          # but ES actually requires auth here\n// after\njaeger:\n  storage:\n    trace_backends:\n      main:\n        elasticsearch:\n          servers: http://es:9200\n          authentication:\n            basic:\n              username: elastic\n              password: \"${ES_PASSWORD}\"","handlingStrategy":"try-catch","validationCode":"// Pre-check connectivity for networked backends before calling CreateTraceStorageFactory\nfor _, be := range []struct{ name string; addr string }{\n    {\"cassandra\", cfg.Cassandra.Servers[0]},\n    {\"elasticsearch\", cfg.Elasticsearch.Servers[0]},\n    {\"clickhouse\", cfg.ClickHouse.Address},\n} {\n    conn, err := net.DialTimeout(\"tcp\", be.addr, 3*time.Second)\n    if err != nil {\n        return fmt.Errorf(\"storage %s unreachable at %s: %w\", be.name, be.addr, err)\n    }\n    conn.Close()\n}","typeGuard":null,"tryCatchPattern":"factory, err := f.CreateTraceStorageFactory(ctx, name, backend, telset)\nif err != nil {\n    if strings.Contains(err.Error(), \"empty configuration\") {\n        // backend type field missing on this named entry; fix config\n    } else {\n        // connection/auth/schema failure — inspect cause via errors.Unwrap\n    }\n    return err\n}","preventionTips":["Ensure the storage backend is reachable and initialized (schema/keyspace/index) before Jaeger starts","Use readiness gating so Jaeger starts only after the DB is up","Give every named trace backend exactly one type field — omitting it yields 'empty configuration'","Verify credentials/TLS settings against the backend before deploy"],"tags":["storage","startup","config"],"backgroundTag":"storage-init-failed","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}