juicedata/juicefs · error

open %s

Error message

open %s

What it means

nfs.go's Get wraps a failure from n.target.Open(p) with the `open %s` message. It means the NFS-backed object storage could not open the requested file path for reading. Paths ending in `/` are special-cased and return an empty reader, so this error always concerns an actual file open failure.

Source

Thrown at pkg/object/nfs.go:129

			return nil, err
		}
		if f2, ok := ff.(*file); ok {
			f2.isSymlink = true
		}
		return ff, nil
	}
	return n.fileInfo(key, fi), nil
}

func (n *nfsStore) Get(ctx context.Context, key string, off, limit int64, getters ...AttrGetter) (io.ReadCloser, error) {
	p := n.path(key)
	if strings.HasSuffix(p, "/") {
		return io.NopCloser(bytes.NewBuffer([]byte{})), nil
	}

	ff, err := n.target.Open(p)
	if err != nil {
		return nil, errors.Wrapf(err, "open %s", p)
	}

	if limit > 0 {
		return &SectionReaderCloser{
			SectionReader: io.NewSectionReader(ff, off, limit),
			Closer:        ff,
		}, nil
	}
	return ff, err
}

func (n *nfsStore) mkdirAll(p string) error {
	p = strings.TrimSuffix(p, "/")
	fi, _, err := n.target.Lookup(p)
	if err == nil {
		if fi.IsDir() {
			logger.Tracef("nfs mkdir: path %s already exists", p)
			return nil

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Verify the file exists on the NFS target at path p (ls the export)
  2. Check read permissions for the user/group the client runs as on the exported file
  3. Confirm the NFS mount is healthy (mount, showmount, try reading the file directly)
  4. Fix the configured NFS target/address so keys resolve to the intended export

Example fix

// before
ff, err := n.target.Open(p)
if err != nil { return nil, errors.Wrapf(err, "open %s", p) }
// after (caller-side guard)
if _, err := os.Stat(localPathFor(key)); err != nil { return nil, err } // handle ENOENT before Get
Defensive patterns

Strategy: try-catch

Validate before calling

if _, err := os.Stat(p); err != nil { return nil, os.ErrNotExist } // caller with direct export access

Try / catch

r, err := store.Get(ctx, key, off, limit)
if err != nil {
    var perr *os.PathError
    if errors.As(err, &perr) && errors.Is(perr.Err, syscall.ENOENT) { return errNotFound }
    return err
}

Prevention

When it happens

Trigger: Calling Get on the NFS object storage with a key whose file does not exist on the NFS export, lacks read permission, or when the NFS mount is unavailable/stale at open time.

Common situations: Deleted or renamed files still referenced by metadata, wrong NFS export or subdirectory configured so relative keys don't resolve, permission changes on the export, or stale NFS handles after a server restart.

Understand the failure class

Background: "open() failed", "failed to open file", "cannot create file" — what a file open error means and how to fix it — this error's family across 42 libraries.

Related errors


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