larksuite/cli · warning
resolve save path: empty result for %q
Error message
resolve save path: empty result for %q
What it means
FileIO.ResolvePath returned success but an empty string, which the library treats as a contract violation: a resolved save path must always be a non-empty absolute path. This defensive check catches providers that silently return nothing instead of an error.
Source
Thrown at shortcuts/common/runner.go:658
return p.ResolveFileIO(c)
}
return nil
}
// ResolveSavePath resolves a relative path to a validated absolute path via
// FileIO.ResolvePath. It returns an error if no FileIO provider is registered
// or if the path fails validation (e.g. traversal, symlink escape).
func (ctx *RuntimeContext) ResolveSavePath(path string) (string, error) {
fio := ctx.FileIO()
if fio == nil {
return "", fmt.Errorf("no file I/O provider registered")
}
resolved, err := fio.ResolvePath(path)
if err != nil {
return "", fmt.Errorf("resolve save path: %w", err)
}
if resolved == "" {
return "", fmt.Errorf("resolve save path: empty result for %q", path)
}
return resolved, nil
}
// WrapOpenError matches a FileIO.Open/Stat error and wraps it with the
// caller-provided message prefix.
func WrapOpenError(err error, pathMsg, readMsg string) error {
if err == nil {
return nil
}
if errors.Is(err, fileio.ErrPathValidation) {
return fmt.Errorf("%s: %w", pathMsg, err)
}
return fmt.Errorf("%s: %w", readMsg, err)
}
// WrapInputStatErrorTyped wraps a FileIO.Stat/Open error for input file
// validation, returning a typed validation error with the appropriate message:View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Fix or correctly configure the FileIO provider so ResolvePath always returns a non-empty validated path for valid input
- Verify the provider's base directory is set (non-empty) in the runtime configuration
- If you maintain a custom provider, add a check returning an explicit error when the computed path is empty
Example fix
// before
resolved := filepath.Join(base, path) // base may be ""
return resolved, nil
// after
if resolved == "" { return "", fmt.Errorf("resolve path: empty result for %q", path) }
return resolved, nil Defensive patterns
Strategy: type-guard
Validate before calling
resolved, err := ctx.ResolveSavePath(path)
if err != nil || resolved == "" {
return errs.NewValidationError(errs.SubtypeFailedPrecondition, "path resolver returned no path")
} Type guard
func validSavePath(p string, err error) bool { return err == nil && p != "" && filepath.IsAbs(p) } Try / catch
out, err := ctx.ResolveSavePath(path)
if err != nil {
if strings.Contains(err.Error(), "empty result") {
// FileIO provider bug/misconfig: check base dir
}
return err
} Prevention
- Ensure the FileIO provider's base directory is configured and non-empty
- Treat empty resolver output as a provider bug and fail fast
- Add a regression test asserting ResolvePath never returns ("", nil) for valid input
When it happens
Trigger: A FileIO provider implementation bug (or misconfigured base directory) causing ResolvePath to return ("", nil) for the given input path.
Common situations: Custom or stub FileIO providers returning empty results; a provider configured with an empty/missing base directory; plugin hosts implementing the FileIO interface incorrectly.
Related errors
- returned nil without an error
- no file I/O provider registered
- resolve save path: %w
- Invalid column: {column!r}
- Invalid column index: {index}
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/f548ff4b116ea472.
Report an issue: GitHub.