{"id":"f9684369da438227","repo":"docker/cli","slug":"checking-context-w","errorCode":null,"errorMessage":"checking context: %w","messagePattern":"checking context: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/image/build.go","lineNumber":275,"sourceCode":"\t\tcontextDir = tempDir\n\tcase build.ContextTypeRemote:\n\t\tbuildCtx, relDockerfile, err = build.GetContextFromURL(progBuff, options.context, options.dockerfileName)\n\t\tif err != nil && options.quiet {\n\t\t\t_, _ = fmt.Fprintln(dockerCli.Err(), progBuff)\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"unable to prepare context: path %q not found\", options.context)\n\t}\n\n\t// read from a directory into tar archive\n\tif buildCtx == nil {\n\t\texcludes, err := build.ReadDockerignore(contextDir)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := build.ValidateContextDirectory(contextDir, excludes); err != nil {\n\t\t\treturn fmt.Errorf(\"checking context: %w\", err)\n\t\t}\n\n\t\t// And canonicalize dockerfile name to a platform-independent one\n\t\trelDockerfile = filepath.ToSlash(relDockerfile)\n\n\t\texcludes = build.TrimBuildFilesFromExcludes(excludes, relDockerfile, options.dockerfileFromStdin())\n\t\tbuildCtx, err = archive.TarWithOptions(contextDir, &archive.TarOptions{\n\t\t\tExcludePatterns: excludes,\n\t\t\tChownOpts:       &archive.ChownOpts{UID: 0, GID: 0},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// replace Dockerfile if it was added from stdin or a file outside the build-context, and there is archive context\n\tif dockerfileCtx != nil && buildCtx != nil {\n\t\tbuildCtx, relDockerfile, err = build.AddDockerfileToBuildContext(dockerfileCtx, buildCtx)","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/image/build.go#L257-L293","documentation":"Error \"checking context: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/image/build.go:275 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}