{"record":{"id":"cbe82cb440676a2a","repo":"amir20/dozzle","slug":"invalid-format-unexpected-key-without-value","errorCode":null,"errorMessage":"invalid format: unexpected key without value","messagePattern":"invalid format: unexpected key without value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/container/logfmt.go","lineNumber":69,"sourceCode":"\t\t\t\t} else if char == ' ' {\n\t\t\t\t\tvalue = log[start:i]\n\t\t\t\t\tresult.Set(key, value)\n\t\t\t\t\tisKey = true\n\t\t\t\t\tstart = i + 1\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Handle the last key-value pair if there is no trailing space\n\tif !isKey && start < len(log) {\n\t\tif inQuotes {\n\t\t\treturn nil, errors.New(\"invalid format: unclosed quotes\")\n\t\t}\n\t\tvalue = log[start:]\n\t\tresult.Set(key, value)\n\t} else if isKey && start < len(log) {\n\t\treturn nil, errors.New(\"invalid format: unexpected key without value\")\n\t}\n\n\tif !isKey {\n\t\tif inQuotes {\n\t\t\treturn nil, errors.New(\"invalid format: unclosed quotes\")\n\t\t}\n\t\tvalue = log[start:]\n\t\tresult.Set(key, value)\n\t}\n\n\treturn result, nil\n}\n\n// unescapeQuoted decodes a quoted logfmt value (including the surrounding\n// quotes) so escape sequences like \\\" and \\\\ produced by logfmt encoders\n// (logrus, go-kit, go-logfmt) yield the original text instead of leaking\n// backslashes into the parsed value. If the sequence is not decodable, the\n// raw content between the quotes is returned unchanged.","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/amir20/dozzle/blob/d9463cbe21874e44ab79db6fa63e746ca7d22928/internal/container/logfmt.go#L51-L87","documentation":"After the final key=value pair the input still contains trailing text where a key is expected (isKey true with unparsed input left). This is a dangling key with no '=' and value, e.g. 'a=1 b', so the line is rejected as malformed logfmt.","triggerScenarios":"Thrown at internal/container/logfmt.go:69 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a value for the dangling key, e.g. 'a=1 b=2'.","Remove the stray trailing token from the log line.","If trailing tokens are acceptable upstream, catch the error and parse only the valid prefix or log the line unstructured."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d9463cbe21874e44ab79db6fa63e746ca7d22928","analyzedAt":"2026-09-07T10:08:55.855Z","contentChangedAt":"2026-09-07T10:08:55.855Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}