{"record":{"id":"3443fd71d30fe8a7","repo":"docker/compose","slug":"operation-cancelled-by-user","errorCode":null,"errorMessage":"operation cancelled by user","messagePattern":"operation cancelled by user","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/compose/options.go","lineNumber":172,"sourceCode":"\t\treturn err\n\t}\n\n\tif noVariables {\n\t\treturn nil\n\t}\n\n\tdisplayInterpolationVariables(dockerCli.Out(), varsInfo)\n\n\t// Prompt for confirmation\n\tuserInput := prompt.NewPrompt(dockerCli.In(), dockerCli.Out())\n\tmsg := \"\\nDo you want to proceed with these variables? [Y/n]: \"\n\tconfirmed, err := userInput.Confirm(msg, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !confirmed {\n\t\treturn fmt.Errorf(\"operation cancelled by user\")\n\t}\n\n\treturn nil\n}\n\nfunc extractInterpolationVariablesFromModel(ctx context.Context, dockerCli command.Cli, projectOptions *ProjectOptions, cmdEnvs []string) ([]varInfo, bool, error) {\n\tcmdEnvMap := types.NewMappingWithEquals(cmdEnvs).ToMapping()\n\n\t// Create a model without interpolation to extract variables\n\topts := configOptions{\n\t\tnoInterpolate:  true,\n\t\tProjectOptions: projectOptions,\n\t}\n\n\tmodel, err := opts.ToModel(ctx, dockerCli, nil, cli.WithoutEnvironmentResolution, cli.WithLoadOptions(loader.WithSkipValidation))\n\tif err != nil {\n\t\treturn nil, false, err\n\t}","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/cmd/compose/options.go#L154-L190","documentation":"Compose interactively lists the variables it is about to interpolate and asks 'Do you want to proceed with these variables? [Y/n]'. Answering 'n' (or anything not accepted as confirmation) makes the code return this sentinel error, aborting the command before the project is loaded.","triggerScenarios":"Running a compose command in interactive mode where unresolved interpolation variables are detected (e.g. missing .env entries), then declining the confirmation prompt; or a non-terminal stdin feeding something other than 'y' so the prompt defaults are not confirmed.","commonSituations":"First run of a cloned project without a .env file; CI jobs where stdin is closed and the prompt reads EOF/no; users spooked by the variable listing and aborting intentionally.","solutions":["Answer 'Y' at the prompt if the proposed variable values are correct.","Provide the missing variables via .env, --env-file, or exported environment so the prompt never appears.","In automation, run with `-q`/non-interactive settings or pre-create the .env file rather than relying on the prompt."],"exampleFix":"# before\ncp env.example .env  # incomplete copy, prompt appears, user answers n\n\n# after\n# fill required vars first\ncp env.example .env && ${EDITOR:-vi} .env\ndocker compose up","handlingStrategy":"fallback","validationCode":"# bash: ensure all required vars are set so the prompt never appears\nmissing=0\nfor v in $(grep -oP '^\\w+' .env.example 2>/dev/null); do\n  [ -n \"${!v:-}\" ] || { echo \"missing env: $v\" >&2; missing=1; }\ndone\n[ \"$missing\" = 0 ] || exit 2","typeGuard":null,"tryCatchPattern":"if ! docker compose up -d 2>&1 | tee /dev/stderr | grep -q 'operation cancelled by user'; then :; else echo 'user declined interpolation vars — check .env' >&2; exit 2; fi","preventionTips":["Ship a complete .env or document required variables in README.","Never rely on interactive prompts in CI; pre-supply all variables."],"tags":["interactive","interpolation","environment","prompt","user-abort"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}