argoproj/argo-workflows · error

CodeNotFound

CodeNotFound

Error message

err.Error()

What it means

While loading an HDFS artifact, the driver stats the source path on HDFS; if the stat reports the path does not exist, the underlying os error is re-wrapped as a coded Argo error with CodeNotFound. This lets callers (artifact server, controller) distinguish missing artifacts from other failures.

Source

Thrown at workflow/artifacts/hdfs/hdfs.go:153

		HDFSUser:               art.HDFSUser,
		KrbOptions:             krbOptions,
		DataTransferProtection: art.DataTransferProtection,
	}
	return &driver, nil
}

// Load downloads artifacts from HDFS compliant storage
func (driver *ArtifactDriver) Load(ctx context.Context, _ *wfv1.Artifact, path string) error {
	hdfscli, err := createHDFSClient(driver.Addresses, driver.HDFSUser, driver.DataTransferProtection, driver.KrbOptions)
	if err != nil {
		return err
	}
	defer hdfscli.Close()

	srcStat, err := hdfscli.Stat(driver.Path)
	if err != nil {
		if os.IsNotExist(err) {
			return errors.New(errors.CodeNotFound, err.Error())
		}
		return err
	}
	if srcStat.IsDir() {
		return fmt.Errorf("HDFS artifact does not suppot directory copy")
	}

	_, err = os.Stat(path)
	if err != nil && !os.IsNotExist(err) {
		return err
	}

	if os.IsNotExist(err) {
		dirPath := filepath.Dir(driver.Path)
		if dirPath != "." && dirPath != "/" {
			// Follow umask for the permission
			err = os.MkdirAll(dirPath, 0o777)
			if err != nil {

View on GitHub (pinned to 35bff19146)

Solutions

  1. Verify the source path exists: `hdfs dfs -ls <path>` using the same NameNode config the workflow uses.
  2. Fix the artifact's `path`/`subPath` in the spec, including any template expressions that may resolve incorrectly.
  3. Check the producing step actually wrote the file before this step ran (ordering/depends).

Example fix

# before
artifacts:
- from: hdfs://namnode/wrong/dir/out.txt
# after
artifacts:
- from: hdfs://namenode/correct/dir/out.txt
Defensive patterns

Strategy: try-catch

Validate before calling

client, _ := hdfs.New(hdfsAddress, hdfs.User("hdfs"))
if _, err := client.Stat(hdfsPath); err != nil {
    return fmt.Errorf("hdfs source %s missing: %w", hdfsPath, err)
}

Try / catch

if argoerr, ok := err.(errors.CodedError); ok && argoerr.Code() == errors.CodeNotFound {
    // regenerate the artifact or fail gracefully
}
if os.IsNotExist(errors.Cause(err)) { ... }

Prevention

When it happens

Trigger: Calling Load() on an HDFS artifact where `hdfscli.Stat(driver.Path)` returns an os.IsNotExist error — the configured hdfs path (path/subPath) is absent on the NameNode.

Common situations: Upstream step never produced the HDFS file; typo in path or subPath; wrong hdfsConf/hdfsAddress config pointing at a different cluster; file deleted before the consuming step runs.

Related errors


AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03). Data as JSON: /api/errors/fdbcef6eddce0c90. Report an issue: GitHub.