{"record":{"id":"9b9a2c56b4bf4f54","repo":"jaegertracing/jaeger","slug":"trace-ttl-can-either-be-0-or-greater-than-or-equal","errorCode":null,"errorMessage":"trace_ttl can either be 0 or greater than or equal to 1 second","messagePattern":"trace_ttl can either be 0 or greater than or equal to 1 second","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/cassandra/config/config.go","lineNumber":202,"sourceCode":"\treturn cluster, nil\n}\n\nfunc (c *Configuration) String() string {\n\treturn fmt.Sprintf(\"%+v\", *c)\n}\n\nfunc isValidTTL(duration time.Duration) bool {\n\treturn duration == 0 || duration >= time.Second\n}\n\nfunc (c *Configuration) Validate() error {\n\t_, err := govalidator.ValidateStruct(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !isValidTTL(c.Schema.TraceTTL) {\n\t\treturn errors.New(\"trace_ttl can either be 0 or greater than or equal to 1 second\")\n\t}\n\n\tif !isValidTTL(c.Schema.DependenciesTTL) {\n\t\treturn errors.New(\"dependencies_ttl can either be 0 or greater than or equal to 1 second\")\n\t}\n\n\tif c.Schema.CompactionWindow < time.Minute {\n\t\treturn errors.New(\"compaction_window should at least be 1 minute\")\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":184,"sourceCodeEnd":215,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/cassandra/config/config.go#L184-L215","documentation":"Validate() in the Cassandra storage config rejects a Schema.TraceTTL that is neither 0 nor at least 1 second. TTLs must either be disabled (0) or a whole second or more; sub-second values cannot be expressed by Cassandra's schema management, so they are refused rather than silently rounded.","triggerScenarios":"Calling Validate on a cassandra.Configuration (via extension/storage init or TestExporterConfigError etc.) where c.Schema.TraceTTL is between 0 and 1 second exclusive (e.g. 500ms).","commonSituations":"Setting trace_ttl with a sub-second duration parsed from env/config; confusion over duration units in YAML (\"500ms\" vs \"2s\"); programmatically defaulting a duration to a small value.","solutions":["Set Schema.TraceTTL to a duration >= 1 * time.Second (e.g. 72h for typical traces).","Set it to exactly 0 if trace TTL management should be disabled.","Review the trace_ttl value in the Cassandra storage config for unit mistakes."],"exampleFix":"// before\ncfg.Schema.TraceTTL = 500 * time.Millisecond\n// after\ncfg.Schema.TraceTTL = 72 * time.Hour","handlingStrategy":"validation","validationCode":"if ttl != 0 && ttl < time.Second {\n    return errors.New(\"trace_ttl must be 0 or >= 1s\")\n}","typeGuard":null,"tryCatchPattern":"if err := cfg.Validate(); err != nil {\n    logger.Fatal(\"invalid cassandra config\", zap.Error(err))\n}","preventionTips":["Use whole-second or larger TTLs (e.g. 72h).","Use 0 to disable TTL management.","Run Validate() in unit tests over your production config."],"tags":["cassandra","config","ttl"],"backgroundTag":"invalid-config-value","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}