{"record":{"id":"82beef1a8beda3c8","repo":"argoproj/argo-workflows","slug":"dependency-q-exited-with-non-zero-code-d","errorCode":null,"errorMessage":"dependency %q exited with non-zero code: %d","messagePattern":"dependency %q exited with non-zero code: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/argoexec/commands/emissary.go","lineNumber":203,"sourceCode":"\n\tfor _, x := range template.ContainerSet.GetGraph() {\n\t\tif x.Name == containerName {\n\t\t\tfor _, y := range x.Dependencies {\n\t\t\t\tlogger.WithField(\"dependency\", y).Info(ctx, \"waiting for dependency\")\n\t\t\t\tdepDir := filepath.Clean(varRunArgo + \"/ctr/\" + y)\n\t\t\t\t// The dependency container will MkdirAll this too, but may not have\n\t\t\t\t// started yet; pre-create it so we can install an inotify watch on it.\n\t\t\t\tif err = os.MkdirAll(depDir, 0o777); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to create dependency dir: %w\", err)\n\t\t\t\t}\n\t\t\t\tdepExitPath := filepath.Join(depDir, \"exitcode\")\n\t\t\t\tcode, waitErr := waitForDependencyExitCode(ctx, depExitPath, signals)\n\t\t\t\tif waitErr != nil {\n\t\t\t\t\treturn waitErr\n\t\t\t\t}\n\t\t\t\texitCode = code\n\t\t\t\tif exitCode != 0 {\n\t\t\t\t\treturn fmt.Errorf(\"dependency %q exited with non-zero code: %d\", y, exitCode)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tname, err = exec.LookPath(name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to find name in PATH: %w\", err)\n\t}\n\n\tif os.Getenv(\"ARGO_DEBUG_PAUSE_BEFORE\") == \"true\" {\n\t\t// User can create the file: /ctr/NAME_OF_THE_CONTAINER/before\n\t\t// in order to break out of the wait and release the container from\n\t\t// the debugging state.\n\t\tif waitErr := file.WaitForCreate(ctx, varRunArgo+\"/ctr/\"+containerName+\"/before\"); waitErr != nil {\n\t\t\treturn fmt.Errorf(\"failed waiting for debug-pause-before marker: %w\", waitErr)\n\t\t}\n\t}","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/cmd/argoexec/commands/emissary.go#L185-L221","documentation":"In a container-set (emissary) workflow, a container that declares dependencies waits for each dependency's exitcode file and fails immediately if that dependency exited non-zero. This error propagates the dependency's exit code so the workflow step is marked Failed with a clear cause.","triggerScenarios":"A dependency container listed in x.Dependencies terminated with exit code != 0; waitForDependencyExitCode returned that code and runEmissary aborts before starting its own command.","commonSituations":"The dependency container crashed (application error, bad image, OOMKilled with non-zero exit), a sidecar/init-like container in a container set failed its setup, or the dependency's script had a bug.","solutions":["Look at the logs of the dependency container named in the error to find its actual failure","Fix the dependency's command/image so it exits 0","If the dependency may legitimately fail, remove it from Dependencies or make it tolerant (retry strategy / ignore exit code)","Use `argo logs <pod> -c <dependency-container>` and the node's exit code in the UI to confirm"],"exampleFix":"// before\ncontainers:\n- name: main\n  dependencies: [setup]\n- name: setup\n  image: busybox\n  command: [\"sh\", \"-c\", \"exit 1\"]\n// after\n- name: setup\n  image: busybox\n  command: [\"sh\", \"-c\", \"setup.sh || true\"]","handlingStrategy":"retry","validationCode":"// before submit, ensure dependency commands exit 0 in CI smoke tests\n// e.g. docker run --rm <image> <dependency command> && echo ok","typeGuard":null,"tryCatchPattern":"try { await runStep() } catch (e) { const m = e.message.match(/dependency \"(.+?)\" exited with non-zero code: (\\d+)/); if (m) { const logs = await getPodLogs(pod, m[1]); throw new Error(`dep ${m[1]} failed (${m[2]}): ${logs}`) } throw e }","preventionTips":["Add retryStrategy to flaky dependency containers","Lint dependency container commands with a smoke run in CI","Check `argo logs --prefix -c <dep>` first when a container-set step fails","Avoid brittle setup scripts in dependency containers"],"tags":["kubernetes","argoexec","container-set","exit-code","dependencies"],"backgroundTag":"dependency-exited-nonzero","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}