{"record":{"id":"9c45e7e73c4e772c","repo":"argoproj/argo-workflows","slug":"supervisor-reported-pre-main-failure-s","errorCode":null,"errorMessage":"supervisor reported pre-main failure: %s","messagePattern":"supervisor reported pre-main failure: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/argoexec/commands/emissary.go","lineNumber":542,"sourceCode":"\t\t\treturn false, nil\n\t\t}\n\t\treturn true, fmt.Errorf(\"stat supervisor status: %w\", statErr)\n\t}\n\tbody, readErr := os.ReadFile(statusPath)\n\tif readErr != nil {\n\t\t// Stat just succeeded, so a read failure here means we raced the\n\t\t// supervisor's atomic rename (the old inode vanished between stat and\n\t\t// read). Treat it as transient and re-evaluate on the next tick/event\n\t\t// rather than failing the wait.\n\t\t//nolint:nilerr // deliberate: swallow the transient read error and retry\n\t\treturn false, nil\n\t}\n\ttoken, message := parseSupervisorStatus(body)\n\tswitch token {\n\tcase statusReady:\n\t\treturn true, nil\n\tcase statusFailed:\n\t\treturn true, fmt.Errorf(\"supervisor reported pre-main failure: %s\", message)\n\tdefault:\n\t\t// RUNNING, or a transient/partial read: the supervisor is alive only if\n\t\t// it is still heartbeating, i.e. the marker's mtime is fresh.\n\t\tif time.Since(fi.ModTime()) > timeout {\n\t\t\treturn true, fmt.Errorf(\"supervisor presumed dead: no status update within %s\", timeout)\n\t\t}\n\t\treturn false, nil\n\t}\n}\n\n// parseSupervisorStatus splits the marker into its first-line token and the\n// remaining message (used by the FAILED token to carry the cause).\nfunc parseSupervisorStatus(body []byte) (token, message string) {\n\tfirst, rest, _ := strings.Cut(string(body), \"\\n\")\n\treturn strings.TrimSpace(first), strings.TrimSpace(rest)\n}\n\n// waitForDependencyExitCode blocks until the given dependency exitcode file is","sourceCodeStart":524,"sourceCodeEnd":560,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/cmd/argoexec/commands/emissary.go#L524-L560","documentation":"The init-less supervisor writes a status marker whose first line is a token (RUNNING, READY, FAILED). If the token is FAILED, the supervisor's pre-main phase (e.g. artifact loading, template setup) failed, and the emissary surfaces the supervisor's own message via this error, failing the step before main ever runs.","triggerScenarios":"The status marker contains FAILED, with the supervisor's failure reason as the message — typically a failed input-artifact download, template unmarshal error, or other pre-main setup failure in the supervisor.","commonSituations":"Input artifact source unavailable (bad S3/GCS credentials, deleted artifact); malformed template passed via /var/run/argo/template; network egress blocked from the pod to artifact storage.","solutions":["Read the message after the colon in the full error — it is the supervisor's own failure reason and points at the actual cause","Verify artifact source credentials/paths (s3/gcs/artifactory config in the workflow's artifactRepository or artifact locators)","Check pod network policy allows egress to the artifact storage endpoint","Inspect argoexec and supervisor logs for the underlying stack before the FAILED marker was written"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# Pre-submit checks that pre-main cannot fail:\nargo lint my-workflow.yaml\n# verify artifact source reachability and credentials:\nargo archive list  # or test the artifact repository creds out-of-band\nkubectl auth can-i get secrets  # if artifacts pull credentials from secrets","typeGuard":null,"tryCatchPattern":"if err := waitForSupervisorReady(ctx); err != nil {\n    var supErr *SupervisorError\n    if errors.As(err, &supErr) && strings.HasPrefix(supErr.Message, \"supervisor reported pre-main failure:\") {\n        log.Printf(\"pre-main failed: %s — inspect artifact sources and template\", supErr.Message)\n    }\n    return err\n}","preventionTips":["Always read the message after the colon — it names the actual pre-main failure","Validate artifact credentials and repository config before submitting","Run `argo lint` on templates to catch malformed template payloads","Verify network policies allow egress to artifact storage endpoints"],"tags":["kubernetes","argo-workflows","argoexec","supervisor","artifacts"],"backgroundTag":"supervisor-pre-main-failed","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"}