{"record":{"id":"1b035b4c5cee75d2","repo":"kubernetes/kops","slug":"creating-directory-q-w","errorCode":null,"errorMessage":"creating directory %q: %w","messagePattern":"creating directory %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/dump/podlogs.go","lineNumber":99,"sourceCode":"\n\tfor i := 0; i < len(allPods.Items); i++ {\n\t\tresult := <-results\n\t\tif result.err != nil {\n\t\t\tdumpErr = errors.Join(dumpErr, result.err)\n\t\t}\n\t}\n\treturn dumpErr\n}\n\nfunc (d *podLogDumper) getPodLogs(ctx context.Context, pods chan v1.Pod, results chan podLogDumpResult) {\n\tfor pod := range pods {\n\t\tvar podErr error\n\t\tfor _, container := range append(pod.Spec.InitContainers, pod.Spec.Containers...) {\n\t\t\tresPath := path.Join(d.artifactsDir, \"cluster-info\", pod.Namespace, pod.Name, container.Name)\n\n\t\t\terr := os.MkdirAll(path.Dir(resPath), 0755)\n\t\t\tif err != nil {\n\t\t\t\tpodErr = errors.Join(podErr, fmt.Errorf(\"creating directory %q: %w\", resPath, err))\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t{\n\t\t\t\tresp, err := d.k8sClient.CoreV1().Pods(pod.Namespace).GetLogs(pod.Name, &v1.PodLogOptions{Container: container.Name, Previous: true}).Do(ctx).Raw()\n\t\t\t\tvar statusErr *k8sErrors.StatusError\n\t\t\t\tif errors.As(err, &statusErr) {\n\t\t\t\t\tif statusErr.ErrStatus.Code != 400 {\n\t\t\t\t\t\tpodErr = errors.Join(podErr, fmt.Errorf(\"getting pod logs for the previous instance of %v/%v: %w\", pod.Namespace, pod.Name, err))\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\terr := writeContainerLogs(resPath+\".previous.log\", resp)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tpodErr = errors.Join(podErr, err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/dump/podlogs.go#L81-L117","documentation":"Creating the directory tree under the artifacts dir for one pod's container logs failed; a local filesystem error (permissions, path-too-long, or ENOSPC) on the machine running the dump.","triggerScenarios":"Thrown at pkg/dump/podlogs.go:99 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check write permissions and free space in the artifacts directory","Shorten the artifacts dir path if names exceed filesystem limits","Retry after fixing the local filesystem issue"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}