{"record":{"id":"313a6886fa9e0861","repo":"docker/compose","slug":"canceled","errorCode":null,"errorMessage":"canceled","messagePattern":"canceled","errorType":"error_code","errorClass":"ErrCanceled","httpStatus":null,"severity":"warning","filePath":"pkg/api/errors.go","lineNumber":43,"sourceCode":"\t// This will be used by VSCode to detect when creating context if the user needs to login first\n\tExitCodeLoginRequired = 5\n)\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 {","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/pkg/api/errors.go#L25-L61","documentation":"api.ErrCanceled marks user-initiated cancellation. It is returned when the user declines an interactive prompt (e.g. `docker compose publish` asking for confirmation and the user says no — pkg/compose/publish.go returns api.ErrCanceled), and the root command maps it to a friendlier exit path via api.IsErrCanceled / context.Canceled (cmd/compose/compose.go).","triggerScenarios":"Answering 'no' to the publish confirmation prompt; aborting an interactive api operation; ctrl-c flows where cancellation is surfaced as this sentinel rather than a raw context error.","commonSituations":"Non-interactive CI runs that unexpectedly hit a prompt and auto-decline; users aborting publish because the environment variables to be embedded looked wrong.","solutions":["If the cancellation was unintentional, re-run and confirm the prompt (or pass the non-interactive options the command offers so no prompt appears).","In scripts, pass required flags (e.g. --with-environment or the appropriate opt-in) so no interactive confirmation is needed.","In Go code, treat api.IsErrCanceled(err) as a clean exit (not a failure), e.g. exit 0 or a dedicated code."],"exampleFix":"# before: interactive prompt auto-declined in CI\ndocker compose publish myorg/myapp\n\n# after: skip the prompt explicitly where supported\ndocker compose publish --yes myorg/myapp 2>/dev/null || docker compose publish myorg/myapp < <(echo y)","handlingStrategy":"try-catch","validationCode":"# avoid interactive prompts in automation\nexport COMPOSE_ANSI=never\nprintf 'y\\n' | docker compose publish \"$REPO\" # or pass the non-interactive opt-in flag","typeGuard":"func isCanceled(err error) bool { return api.IsErrCanceled(err) || errors.Is(ctx.Err(), context.Canceled) }","tryCatchPattern":"if err := backend.Publish(ctx, project, repo, opts); err != nil {\n    if api.IsErrCanceled(err) {\n        return nil // user declined: clean exit, not a failure\n    }\n    return err\n}","preventionTips":["Treat cancellation as a normal outcome (log at info, exit 0) rather than an error.","Make CI invocations non-interactive so prompts cannot auto-decline unexpectedly."],"tags":["api","sentinel-error","canceled","interactive"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}