{"record":{"id":"5d73afa8b3f6b4c7","repo":"GoogleContainerTools/skaffold","slug":"failed-to-build-w","errorCode":null,"errorMessage":"failed to build: %w","messagePattern":"failed to build: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/skaffold/app/cmd/run.go","lineNumber":48,"sourceCode":")\n\n// NewCmdRun describes the CLI command to run a pipeline.\nfunc NewCmdRun() *cobra.Command {\n\treturn NewCmd(\"run\").\n\t\tWithDescription(\"Run a pipeline\").\n\t\tWithLongDescription(\"Run a pipeline: build and test artifacts, tag them, update Kubernetes manifests and deploy to a cluster.\").\n\t\tWithExample(\"Build, test, deploy and tail the logs\", \"run --tail\").\n\t\tWithExample(\"Run with a given profile\", \"run -p <profile>\").\n\t\tWithCommonFlags().\n\t\tWithHouseKeepingMessages().\n\t\tNoArgs(doRun)\n}\n\nfunc doRun(ctx context.Context, out io.Writer) error {\n\treturn withRunner(ctx, out, func(r runner.Runner, configs []util.VersionedConfig) error {\n\t\tbRes, err := r.Build(ctx, out, targetArtifacts(opts, configs))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to build: %w\", err)\n\t\t}\n\n\t\tif !opts.SkipTests {\n\t\t\terr = r.Test(ctx, out, bRes)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to test: %w\", err)\n\t\t\t}\n\t\t}\n\n\t\t// Render\n\t\tmanifestList, err := r.Render(ctx, out, bRes, false)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"rendering manifests: %w\", err)\n\t\t}\n\t\tif opts.RenderOnly {\n\t\t\treturn manifest.Write(manifestList.String(), opts.RenderOutput, out)\n\t\t}\n","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/cmd/skaffold/app/cmd/run.go#L30-L66","documentation":"`skaffold run` builds all target artifacts first via `r.Build`; this wrapper reports a build failure and aborts run before testing/deploying. It means at least one artifact failed to build, so the full run (test → deploy) pipeline stops here.","triggerScenarios":"`skaffold run` where the build phase fails: Dockerfile error, base image pull failure (auth or network), source compile error, buildkit cache issues, or a build dependency (gradle/maven/npm) failing.","commonSituations":"CI pipelines running skaffold run without registry credentials; missing Docker daemon in the CI runner; code that doesn't compile; private base images not pullable; port/file locks during concurrent builds.","solutions":["Run `skaffold build` alone to isolate and see the raw build error.","Fix the underlying build problem indicated by the wrapped error (Dockerfile, deps, compile).","Ensure registry authentication (docker login / credential helper) and the Docker daemon are available.","Use `skaffold dev` interactively for faster iteration on build errors, or --cache-artifacts to leverage caching."],"exampleFix":"# before: private base image without auth\nFROM gcr.io/my-project/base:latest\n# after: authenticate before skaffold run\ngcloud auth configure-docker gcr.io\nskaffold run\n","handlingStrategy":"try-catch","validationCode":"// Pre-flight before skaffold run in CI\nconst fs = require('fs');\ntry { execSync('docker info', {stdio: 'ignore'}); } catch { throw new Error('Docker daemon unavailable'); }\nif (!fs.existsSync('Dockerfile')) throw new Error('Dockerfile missing at repo root');\n// isolate build first so run only fails on test/deploy issues\nexecFileSync('skaffold', ['build', '-q'], {stdio: 'pipe'});","typeGuard":null,"tryCatchPattern":"try {\n  execFileSync('skaffold', ['run'], {stdio: 'pipe'});\n} catch (e) {\n  const msg = e.stderr?.toString() ?? '';\n  if (msg.includes('failed to build')) {\n    console.error('skaffold run aborted at build; run `skaffold build` for the raw error:', msg);\n    // fix Dockerfile/registry/compile issue, then retry\n  } else throw e;\n}","preventionTips":["Run `skaffold build` as a separate CI step so build errors are isolated from deploy.","Configure registry credentials (docker login / gcloud auth) before skaffold run.","Keep Dockerfiles and dependencies linted/compiled locally before pushing.","Pin base image tags and pre-pull them to avoid registry flakiness."],"tags":["skaffold","build","docker","run"],"backgroundTag":"build-failed","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}