{"record":{"id":"bbf7a6bfbe381de6","repo":"jaegertracing/jaeger","slug":"attribute-metadata-cache-ttl-must-be-a-non-negativ","errorCode":null,"errorMessage":"attribute_metadata_cache_ttl must be a non-negative duration","messagePattern":"attribute_metadata_cache_ttl must be a non-negative duration","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/v2/clickhouse/config.go","lineNumber":97,"sourceCode":"\tif _, err := govalidator.ValidateStruct(cfg); err != nil {\n\t\treturn err\n\t}\n\tif cfg.TTL < 0 {\n\t\treturn errors.New(\"ttl must be a non-negative duration\")\n\t}\n\tif cfg.TTL > 0 && cfg.TTL%time.Second != 0 {\n\t\treturn errors.New(\"ttl must be a whole number of seconds\")\n\t}\n\t// A search depth of zero would make every trace search return nothing, and a\n\t// negative one is meaningless, so reject both rather than querying with them.\n\tif cfg.DefaultSearchDepth <= 0 {\n\t\treturn errors.New(\"default_search_depth must be a positive number\")\n\t}\n\tif cfg.MaxSearchDepth <= 0 {\n\t\treturn errors.New(\"max_search_depth must be a positive number\")\n\t}\n\tif cfg.AttributeMetadataCacheTTL < 0 {\n\t\treturn errors.New(\"attribute_metadata_cache_ttl must be a non-negative duration\")\n\t}\n\tif cfg.AttributeMetadataCacheMaxSize < 0 {\n\t\treturn errors.New(\"attribute_metadata_cache_max_size must be a non-negative number\")\n\t}\n\treturn nil\n}\n","sourceCodeStart":79,"sourceCodeEnd":104,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/v2/clickhouse/config.go#L79-L104","documentation":"ClickHouse Configuration.Validate returns this error when AttributeMetadataCacheTTL is negative. The attribute metadata cache TTL controls how long cached attribute metadata lives and must be non-negative.","triggerScenarios":"Validating a ClickHouse Configuration whose AttributeMetadataCacheTTL is below zero.","commonSituations":"Negative duration parsed from a YAML/env config; sign error when computing TTL programmatically; copying a value with a leading minus.","solutions":["Set attribute_metadata_cache_ttl to a non-negative duration","Fix the configuration source so it cannot produce negative durations","Note that unlike main TTL there is no whole-second requirement — only non-negativity is checked"],"exampleFix":"// before\nattribute_metadata_cache_ttl: -5m\n// after\nattribute_metadata_cache_ttl: 5m","handlingStrategy":"validation","validationCode":"if cfg.AttributeMetadataCacheTTL < 0 {\n    return errors.New(\"attribute_metadata_cache_ttl must be a non-negative duration\")\n}","typeGuard":"func nonNegative(d time.Duration) bool { return d >= 0 }","tryCatchPattern":"if err := cfg.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"attribute_metadata_cache_ttl must be a non-negative duration\") {\n        cfg.AttributeMetadataCacheTTL = defaultCacheTTL\n    }\n}","preventionTips":["Check sign of computed durations before assigning to config","Avoid -1 sentinels for cache TTLs","Validate all cache-related fields together at load time"],"tags":["clickhouse","configuration","cache","jaeger"],"backgroundTag":"invalid-config-value","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}