juicedata/juicefs · error

create %s

Error message

create %s

What it means

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.

Source

Thrown at pkg/object/nfs.go:195

		}
		tmp = TmpFilePath(p, name)
		defer func() {
			if err != nil {
				_ = n.target.Remove(tmp)
			}
		}()
	}
	_, err = n.target.Create(tmp, n.fmode)
	if os.IsNotExist(err) {
		_ = n.mkdirAll(path.Dir(p))
		_, err = n.target.Create(tmp, n.fmode)
	}
	if os.IsExist(err) {
		_ = n.target.Remove(tmp)
		_, err = n.target.Create(tmp, n.fmode)
	}
	if err != nil {
		return errors.Wrapf(err, "create %s", tmp)
	}
	ff, err := n.target.Open(tmp)
	if err != nil {
		return err
	}

	buf := bufPool.Get().(*[]byte)
	defer bufPool.Put(buf)
	_, err = io.CopyBuffer(ff, in, *buf)
	if err != nil {
		_ = ff.Close()
		return err
	}
	err = ff.Close()
	if err != nil {
		return err
	}
	if !PutInplace {

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Check the export is writable by the client user (touch a test file in the target dir)
  2. Remove stale temp files matching the tmp pattern on the NFS target
  3. Check filesystem space (df -h) and mount flags (rw vs ro) on the NFS export
  4. Adjust fmode/export permissions (root_squash, no_root_squash, uid/gid mapping) as needed

Example fix

// before
n.target.Create(tmp, 0600) // fails under root_squash when running as root
// after
// run client as an unprivileged user mapped on the export, or
n.target.Create(tmp, 0644) // mode permitted by export policy
Defensive patterns

Strategy: try-catch

Validate before calling

if err := unix.Access(tmpDir, unix.W_OK); err != nil { return errors.New("nfs target not writable") }

Try / catch

err := store.Put(ctx, key, data)
if err != nil && strings.HasPrefix(err.Error(), "create ") {
    if errors.Is(err, os.ErrPermission) { return fmt.Errorf("nfs export not writable: %w", err) }
    if errors.Is(err, syscall.ENOSPC) { return errors.New("nfs export full") }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/9d1034940116bfa3. Report an issue: GitHub.