{"record":{"id":"e0dfce1d4b4f084f","repo":"nats-io/nats-server","slug":"expected-zulu-formatted-datetime-but-got-s","errorCode":null,"errorMessage":"expected Zulu formatted DateTime, but got '%s'","messagePattern":"expected Zulu formatted DateTime, but got '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"conf/parse.go","lineNumber":372,"sourceCode":"\t\t\t\treturn fmt.Errorf(\"float '%s' is out of the range\", it.val)\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"expected float, but got '%s'\", it.val)\n\t\t}\n\t\tsetValue(it, num)\n\tcase itemBool:\n\t\tswitch strings.ToLower(it.val) {\n\t\tcase \"true\", \"yes\", \"on\":\n\t\t\tsetValue(it, true)\n\t\tcase \"false\", \"no\", \"off\":\n\t\t\tsetValue(it, false)\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"expected boolean value, but got '%s'\", it.val)\n\t\t}\n\n\tcase itemDatetime:\n\t\tdt, err := time.Parse(\"2006-01-02T15:04:05Z\", it.val)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"expected Zulu formatted DateTime, but got '%s'\", it.val)\n\t\t}\n\t\tsetValue(it, dt)\n\tcase itemArrayStart:\n\t\tvar array = make([]any, 0)\n\t\tp.pushContext(array)\n\tcase itemArrayEnd:\n\t\tarray := p.ctx\n\t\tp.popContext()\n\t\tsetValue(it, array)\n\tcase itemVariable:\n\t\tvalue, found, err := p.lookupVariable(it.val)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"variable reference for '%s' on line %d could not be parsed: %s\",\n\t\t\t\tit.val, it.line, err)\n\t\t}\n\t\tif !found {\n\t\t\treturn fmt.Errorf(\"variable reference for '%s' on line %d can not be found\",","sourceCodeStart":354,"sourceCodeEnd":390,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/conf/parse.go#L354-L390","documentation":"An item classified as a datetime was parsed with time.Parse using the fixed layout \"2006-01-02T15:04:05Z\", which only accepts Zulu (UTC, literal 'Z' suffix) timestamps. Any other format or offset fails and the parser reports the raw value.","triggerScenarios":"processItem (from parse) hits case itemDatetime with values like '2024-01-02 15:04:05', '2024-01-02T15:04:05+02:00', '2024-01-02', or RFC3339 with nanoseconds '2024-01-02T15:04:05.123Z'.","commonSituations":"Copying timestamps from logs or other systems in local-time or with timezone offsets, omitting the 'T'/seconds, or including fractional seconds.","solutions":["Rewrite the value in Zulu form: YYYY-MM-DDTHH:MM:SSZ, e.g. 2024-01-02T15:04:05Z.","Convert any timezone offset to UTC and suffix 'Z' instead of '+HH:MM'.","Drop fractional seconds or move the timestamp to a string field and parse it yourself with time.RFC3339.","Quote the value as a string if you must keep the original format."],"exampleFix":"// before\nexpires = 2024-01-02T15:04:05+02:00\n// after\nexpires = 2024-01-02T13:04:05Z","handlingStrategy":"validation","validationCode":"if _, err := time.Parse(\"2006-01-02T15:04:05Z\", raw); err != nil {\n\tt, err2 := time.Parse(time.RFC3339, raw)\n\tif err2 != nil { return err }\n\traw = t.UTC().Format(\"2006-01-02T15:04:05Z\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always store timestamps in UTC Zulu format without fractional seconds.","Normalize offsets (e.g. +02:00) to 'Z' when generating configs.","Validate datetime fields with the exact Zulu layout before parsing configs."],"tags":["config","parsing","datetime","timezone"],"backgroundTag":"datetime-format-mismatch","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}