{"record":{"id":"906aac6c761bd4d3","repo":"argoproj/argo-workflows","slug":"creating-file-failed-w","errorCode":null,"errorMessage":"creating file failed: %w","messagePattern":"creating file failed: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/argo/commands/cp.go","lineNumber":146,"sourceCode":"\t\treturn fmt.Errorf(\"failed to create request: %w\", err)\n\t}\n\tauthString, err := client.GetAuthString(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\trequest.Header.Set(\"Authorization\", authString)\n\tresp, err := c.Do(request)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"request failed with: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"request failed %s\", resp.Status)\n\t}\n\tartifactFilePath := filepath.Join(customPath, fileName)\n\tfileWriter, err := os.Create(artifactFilePath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"creating file failed: %w\", err)\n\t}\n\tdefer fileWriter.Close()\n\t_, err = io.Copy(fileWriter, resp.Body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"copying file contents failed: %w\", err)\n\t}\n\tlog.Printf(\"Created %q\", fileName)\n\treturn nil\n}\n","sourceCodeStart":128,"sourceCodeEnd":156,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/cmd/argo/commands/cp.go#L128-L156","documentation":"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.","triggerScenarios":"Thrown at cmd/argo/commands/cp.go:146 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create the output directory first (mkdir -p) or use an existing --output-path","Fix local filesystem permissions"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}