{"id":"f42d7da4c696cad6","repo":"docker/cli","slug":"removing-image-id-file-w","errorCode":null,"errorMessage":"removing image ID file: %w","messagePattern":"removing image ID file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/image/build.go","lineNumber":224,"sourceCode":"\t}\n\n\tif options.dockerfileFromStdin() {\n\t\tif contextType == build.ContextTypeStdin {\n\t\t\treturn errors.New(\"invalid argument: can't use stdin for both build context and dockerfile\")\n\t\t}\n\t\tdockerfileCtx = dockerCli.In()\n\t}\n\n\tprogBuff = dockerCli.Out()\n\tbuildBuff = dockerCli.Out()\n\tif options.quiet {\n\t\tprogBuff = bytes.NewBuffer(nil)\n\t\tbuildBuff = bytes.NewBuffer(nil)\n\t}\n\tif options.imageIDFile != \"\" {\n\t\t// Avoid leaving a stale file if we eventually fail\n\t\tif err := os.Remove(options.imageIDFile); err != nil && !os.IsNotExist(err) {\n\t\t\treturn fmt.Errorf(\"removing image ID file: %w\", err)\n\t\t}\n\t}\n\n\tswitch contextType {\n\tcase build.ContextTypeStdin:\n\t\t// buildCtx is tar archive. if stdin was dockerfile then it is wrapped\n\t\tbuildCtx, relDockerfile, err = build.GetContextFromReader(dockerCli.In(), options.dockerfileName)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to prepare context from STDIN: %w\", err)\n\t\t}\n\tcase build.ContextTypeLocal:\n\t\tcontextDir, relDockerfile, err = build.GetContextFromLocalDir(options.context, options.dockerfileName)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to prepare context: %s\", err)\n\t\t}\n\t\tif strings.HasPrefix(relDockerfile, \"..\"+string(filepath.Separator)) {\n\t\t\t// Dockerfile is outside build-context; read the Dockerfile and pass it as dockerfileCtx\n\t\t\tdockerfileCtx, err = os.Open(options.dockerfileName)","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/image/build.go#L206-L242","documentation":"Error \"removing image ID file: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/image/build.go:224 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}