{"record":{"id":"70617cba0291bf30","repo":"docker/compose","slug":"parsing-failed","errorCode":null,"errorMessage":"parsing failed","messagePattern":"parsing failed","errorType":"error_code","errorClass":"ErrParsingFailed","httpStatus":null,"severity":"error","filePath":"pkg/api/errors.go","lineNumber":45,"sourceCode":")\n\nvar (\n\t// ErrNotFound is returned when an object is not found\n\tErrNotFound = errors.New(\"not found\")\n\t// ErrAlreadyExists is returned when an object already exists\n\tErrAlreadyExists = errors.New(\"already exists\")\n\t// ErrForbidden is returned when an operation is not permitted\n\tErrForbidden = errors.New(\"forbidden\")\n\t// ErrUnknown is returned when the error type is unmapped\n\tErrUnknown = errors.New(\"unknown\")\n\t// ErrNotImplemented is returned when a backend doesn't implement an action\n\tErrNotImplemented = errors.New(\"not implemented\")\n\t// ErrUnsupportedFlag is returned when a backend doesn't support a flag\n\tErrUnsupportedFlag = errors.New(\"unsupported flag\")\n\t// ErrCanceled is returned when the command was canceled by user\n\tErrCanceled = errors.New(\"canceled\")\n\t// ErrParsingFailed is returned when a string cannot be parsed\n\tErrParsingFailed = errors.New(\"parsing failed\")\n\t// ErrNoResources is returned when operation didn't selected any resource\n\tErrNoResources = errors.New(\"no resources\")\n)\n\n// IsNotFoundError returns true if the unwrapped error is ErrNotFound\nfunc IsNotFoundError(err error) bool {\n\treturn errors.Is(err, ErrNotFound)\n}\n\n// IsAlreadyExistsError returns true if the unwrapped error is ErrAlreadyExists\nfunc IsAlreadyExistsError(err error) bool {\n\treturn errors.Is(err, ErrAlreadyExists)\n}\n\n// IsForbiddenError returns true if the unwrapped error is ErrForbidden\nfunc IsForbiddenError(err error) bool {\n\treturn errors.Is(err, ErrForbidden)\n}","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/pkg/api/errors.go#L27-L63","documentation":"api.ErrParsingFailed is the sentinel for string-to-object parse failures inside the api layer (for example failing to parse a filter value, an ID, or a serialized payload into its structured form). It exists so callers can distinguish malformed input from engine/transport errors.","triggerScenarios":"Passing a malformed string to an api helper that must parse it (e.g. an invalid filter or argument format reaching a parsing function); backends wrapping decode errors into this sentinel.","commonSituations":"Hand-written filter strings with bad syntax; payloads produced by a different compose version being parsed by an older one; scripts feeding unescaped values into parse-based options.","solutions":["Correct the input string to the documented format for the option being parsed.","Validate values in your script before passing them (regex or dry-run with docker compose config).","On version-skew suspicions, align composer/engine versions and retry."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# dry-run parse check before the real command\ndocker compose config --quiet || { echo \"compose file/inputs failed to parse\" >&2; exit 1; }","typeGuard":"func isParsingFailed(err error) bool { return errors.Is(err, api.ErrParsingFailed) }","tryCatchPattern":"if err := parseInput(s); err != nil {\n    if errors.Is(err, api.ErrParsingFailed) {\n        return fmt.Errorf(\"invalid input %q: %w\", s, err)\n    }\n    return err\n}","preventionTips":["Validate user-supplied strings against the documented format before passing them to parse-based options.","Use docker compose config as a pre-flight parse check in CI."],"tags":["api","sentinel-error","parsing"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}