argoproj/argo-workflows · error

creating file failed: %w

Error message

creating file failed: %w

What it means

argo cp could not create the local output file (os.Create on filepath.Join(customPath, fileName)) for a downloaded artifact; the wrapped OS error typically indicates a missing directory or permission denial on the local path.

Source

Thrown at cmd/argo/commands/cp.go:146

		return fmt.Errorf("failed to create request: %w", err)
	}
	authString, err := client.GetAuthString(ctx)
	if err != nil {
		return err
	}
	request.Header.Set("Authorization", authString)
	resp, err := c.Do(request)
	if err != nil {
		return fmt.Errorf("request failed with: %w", err)
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusOK {
		return fmt.Errorf("request failed %s", resp.Status)
	}
	artifactFilePath := filepath.Join(customPath, fileName)
	fileWriter, err := os.Create(artifactFilePath)
	if err != nil {
		return fmt.Errorf("creating file failed: %w", err)
	}
	defer fileWriter.Close()
	_, err = io.Copy(fileWriter, resp.Body)
	if err != nil {
		return fmt.Errorf("copying file contents failed: %w", err)
	}
	log.Printf("Created %q", fileName)
	return nil
}

View on GitHub (pinned to 35bff19146)

Solutions

  1. Create the output directory first (mkdir -p) or use an existing --output-path
  2. Fix local filesystem permissions
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at cmd/argo/commands/cp.go:146 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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