argoproj/argo-workflows · error
neither %s nor %s is available
Error message
neither %s nor %s is available
What it means
The executor reads the workflow template from /var/run/argo/template, falling back to the ARGO_TEMPLATE environment variable. This error means neither source exists, so argoexec has no template to run and cannot proceed. It indicates a broken pod setup — the component responsible for injecting the template (init container or supervisor) never delivered it.
Source
Thrown at cmd/argoexec/commands/emissary.go:330
// sets ARGO_TEMPLATE directly on main in that case.
//
// Offload-sentinel resolution is shared with the legacy init container via
// common.ResolveTemplateEnvValue.
func readTemplate() ([]byte, error) {
return readTemplateAt(varRunArgo+"/template", common.EnvConfigMountPath)
}
// readTemplateAt is the path-parameterized form used by tests; production
// calls readTemplate with the constants.
func readTemplateAt(filePath, offloadDir string) ([]byte, error) {
if data, err := os.ReadFile(filePath); err == nil {
return data, nil
} else if !errors.Is(err, os.ErrNotExist) {
return nil, err
}
envVal, ok := os.LookupEnv(common.EnvVarTemplate)
if !ok {
return nil, fmt.Errorf("neither %s nor %s is available", filePath, common.EnvVarTemplate)
}
return common.ResolveTemplateEnvValue(envVal, offloadDir)
}
func stageInputArtifacts(ctx context.Context, tmpl *wfv1.Template) error {
return stageInputArtifactsAt(ctx, common.ExecutorArtifactBaseDir, tmpl)
}
// stageInputArtifactsAt is the parameterized form used by tests; production
// calls stageInputArtifacts with the constants. It links each input artifact
// into place and re-enters the working directory afterwards, stepping off it
// for the duration: linking replaces the cwd when an artifact's path is the
// container's workingDir, Windows refuses to delete a directory in use as a
// working directory, and a child forked with the deleted directory as cwd
// would see getcwd() fail and relative paths resolve to nothing. The final
// chdir follows the symlink to whatever now sits at the path.
func stageInputArtifactsAt(ctx context.Context, baseDir string, tmpl *wfv1.Template) error {
origWd, err := os.Getwd()View on GitHub (pinned to 35bff19146)
Solutions
- Run argoexec only through a real workflow pod where the controller injects the template.
- For manual testing, export ARGO_TEMPLATE with the serialized template JSON (or point to the offloaded sentinel value).
- Check the init/wait or supervisor container logs — if it crashed, /var/run/argo/template was never written.
- Ensure the /var/run/argo emptyDir volume is present in the pod spec.
- Set ARGO_DEBUG_PAUSE or inspect the pod's init container status to find why setup failed.
Example fix
// before (manual exec, no template)
argoexec emissary -- mycmd
// after
export ARGO_TEMPLATE='{"name":"main",...}'
argoexec emissary -- mycmd Defensive patterns
Strategy: validation
Validate before calling
// Before running argoexec manually, ensure a template source exists: if [ ! -f /var/run/argo/template ] && [ -z "$ARGO_TEMPLATE" ]; then echo "set ARGO_TEMPLATE or run inside a workflow pod" >&2; exit 1 fi
Try / catch
try {
await executor.run()
} catch (e) {
if (String(e).includes('neither /var/run/argo/template nor ARGO_TEMPLATE')) {
// supply ARGO_TEMPLATE or fix init/supervisor injection
}
} Prevention
- Run argoexec only via real workflow pods.
- Keep the /var/run/argo emptyDir volume intact in pod specs.
- Check init/wait and supervisor container logs first when a pod misbehaves.
- For local experiments, always export a valid ARGO_TEMPLATE JSON.
When it happens
Trigger: readTemplateAt finds os.ErrNotExist for /var/run/argo/template AND os.LookupEnv(ARGO_TEMPLATE) reports the env var is unset — e.g. running the emissary binary manually outside a workflow pod, or the init/supervisor stage failed before writing the template file.
Common situations: Developers exec-ing `argoexec emissary <cmd>` directly in a pod for testing without setting ARGO_TEMPLATE; a custom/modified pod spec dropping the /var/run/argo emptyDir mount; upgraded controller where init-less templates still expect the supervisor to write the file; local unit-style experiments with a bare docker run.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- failed to read container args file %s: %w
- failed to unmarshal container args: %w
- failed to read template: %w
- failed to start command: %w
- failed to write large arg %d to file: %w
AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03).
Data as JSON: /api/errors/fa09e2d75bd0ef04.
Report an issue: GitHub.