{"record":{"id":"015a624242f73de7","repo":"weaviate/weaviate","slug":"create-parent-folder-for-s-w-015a62","errorCode":null,"errorMessage":"create parent folder for %s: %w","messagePattern":"create parent folder for (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cluster/replication/copier/copier.go","lineNumber":328,"sourceCode":"\t\t\t\treturn err\n\t\t\t}\n\t\t} else if checksum == meta.Crc32 {\n\t\t\t// local file matches remote one, no need to download it\n\t\t\tcontinue\n\t\t}\n\n\t\tstream, err := client.GetReplicaSnapshotFile(ctx, &protocol.GetReplicaSnapshotFileRequest{\n\t\t\tIndexName: meta.IndexName,\n\t\t\tOpId:      string(opID),\n\t\t\tFileName:  meta.FileName,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to send GetFile request for %s: %w\", meta.FileName, err)\n\t\t}\n\n\t\tdir := path.Dir(localFilePath)\n\t\tif err := os.MkdirAll(dir, os.ModePerm); err != nil {\n\t\t\treturn fmt.Errorf(\"create parent folder for %s: %w\", localFilePath, err)\n\t\t}\n\n\t\ttmpPath := localFilePath + \".tmp\"\n\n\t\tif err := func() error {\n\t\t\tf, err := os.Create(tmpPath)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"open file %q for writing: %w\", tmpPath, err)\n\t\t\t}\n\t\t\teg := enterrors.NewErrorGroupWrapper(c.logger)\n\t\t\teg.SetLimit(_NUMCPU)\n\t\t\t// Drain writers before closing the FD: a late WriteAt against a\n\t\t\t// recycled descriptor would otherwise land on the wrong file.\n\t\t\tdefer func() {\n\t\t\t\t_ = eg.Wait()\n\t\t\t\tif f != nil {\n\t\t\t\t\t_ = f.Close()\n\t\t\t\t}","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/cluster/replication/copier/copier.go#L310-L346","documentation":"os.MkdirAll failed when creating the local parent directory that will hold the downloaded shard file. The copier recreates the shard's directory tree under the node's data path before writing the .tmp file.","triggerScenarios":"MkdirAll on path.Dir(localFilePath) fails because the data directory's parent is missing/unwritable, a non-directory file exists at a path component, the disk is full or read-only, or permissions/ownership of the data dir are wrong (e.g. run as different user).","commonSituations":"PERSISTENCE_DATA_PATH mounted read-only or full; data dir owned by another user after a container image/user change; a stale file occupies a directory name (e.g. leftover from a torn migration); NFS/emptyDir volume issues in Kubernetes.","solutions":["Check the wrapped errno in the error: if EACCES, fix ownership/permissions of the data path (chown/chmod to the weaviate process user).","If ENOTDIR, remove the stray file occupying a directory component of the path.","If ENOSPC or EROFS, free disk space or remount the volume read-write.","Verify PERSISTENCE_DATA_PATH points to a writable, persistent volume in your deployment."],"exampleFix":"// before: dir exists as a file, MkdirAll fails\n$ ls /var/lib/weaviate\nsome-shard-dir   (regular file)\n// after: remove the stray file so the directory tree can be created\n$ rm /var/lib/weaviate/some-shard-dir && systemctl restart weaviate","handlingStrategy":"validation","validationCode":"dir := filepath.Join(dataPath, \"\")\nif st, err := os.Stat(dir); err != nil {\n    return fmt.Errorf(\"data path missing: %w\", err)\n} else if !st.IsDir() {\n    return fmt.Errorf(\"data path is not a directory: %s\", dir)\n}\nif err := syscall.Access(dir, os.O_RDWR); err != nil {\n    return fmt.Errorf(\"data path not writable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify PERSISTENCE_DATA_PATH is writable by the weaviate user at startup (pre-flight check).","Mount the data path on a persistent, read-write volume, not emptyDir or read-only mounts.","Do not place regular files where shard directories are expected.","Monitor disk mounts for read-only remounts after filesystem errors."],"tags":["filesystem","permissions","replication","disk"],"backgroundTag":"filesystem-permission-denied","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}