{"record":{"id":"9d1034940116bfa3","repo":"juicedata/juicefs","slug":"create-s","errorCode":null,"errorMessage":"create %s","messagePattern":"create (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/object/nfs.go","lineNumber":195,"sourceCode":"\t\t}\n\t\ttmp = TmpFilePath(p, name)\n\t\tdefer func() {\n\t\t\tif err != nil {\n\t\t\t\t_ = n.target.Remove(tmp)\n\t\t\t}\n\t\t}()\n\t}\n\t_, err = n.target.Create(tmp, n.fmode)\n\tif os.IsNotExist(err) {\n\t\t_ = n.mkdirAll(path.Dir(p))\n\t\t_, err = n.target.Create(tmp, n.fmode)\n\t}\n\tif os.IsExist(err) {\n\t\t_ = n.target.Remove(tmp)\n\t\t_, err = n.target.Create(tmp, n.fmode)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"create %s\", tmp)\n\t}\n\tff, err := n.target.Open(tmp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbuf := bufPool.Get().(*[]byte)\n\tdefer bufPool.Put(buf)\n\t_, err = io.CopyBuffer(ff, in, *buf)\n\tif err != nil {\n\t\t_ = ff.Close()\n\t\treturn err\n\t}\n\terr = ff.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !PutInplace {","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/object/nfs.go#L177-L213","documentation":"nfs.go's Put wraps a failure to create the temporary file on the NFS target with `create %s`. The code first tries n.target.Create(tmp, n.fmode); if it fails with EEXIST it removes the temp file and retries, and any remaining error is wrapped with this message. It means writing to the NFS export failed at file-creation time, before any data is uploaded.","triggerScenarios":"Calling Put when the temp-file path already exists and cannot be removed, the target directory is not writable, the NFS filesystem is full/readonly, or fmode bits are denied by the export's root-squash/permissions.","commonSituations":"Read-only NFS mounts or root_squash denying writes, leftover stale temp files owned by another user, disk-full conditions on the export, or a misconfigured target directory that doesn't exist or isn't writable.","solutions":["Check the export is writable by the client user (touch a test file in the target dir)","Remove stale temp files matching the tmp pattern on the NFS target","Check filesystem space (df -h) and mount flags (rw vs ro) on the NFS export","Adjust fmode/export permissions (root_squash, no_root_squash, uid/gid mapping) as needed"],"exampleFix":"// before\nn.target.Create(tmp, 0600) // fails under root_squash when running as root\n// after\n// run client as an unprivileged user mapped on the export, or\nn.target.Create(tmp, 0644) // mode permitted by export policy","handlingStrategy":"try-catch","validationCode":"if err := unix.Access(tmpDir, unix.W_OK); err != nil { return errors.New(\"nfs target not writable\") }","typeGuard":null,"tryCatchPattern":"err := store.Put(ctx, key, data)\nif err != nil && strings.HasPrefix(err.Error(), \"create \") {\n    if errors.Is(err, os.ErrPermission) { return fmt.Errorf(\"nfs export not writable: %w\", err) }\n    if errors.Is(err, syscall.ENOSPC) { return errors.New(\"nfs export full\") }\n    return err\n}","preventionTips":["Pre-clean stale tmp files from the NFS target","Monitor export free space and mount rw state","Run as a user allowed by export policy (root_squash aware)","Use a dedicated writable directory as the NFS target"],"tags":["nfs","file-write","object-storage","io"],"backgroundTag":"file-write-failed","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}