lima-vm/lima · error

path is empty

Error message

path is empty

What it means

TranslateHostPath validates host paths passed to MCP file tools before they reach the VM layer. It rejects an empty hostPath string with 'path is empty' because an empty path can never be translated into a valid guest-side location. It is a fast-fail guard so callers get a clear message instead of downstream file operations failing confusingly.

Source

Thrown at pkg/mcp/toolset/toolset.go:107

	mcp.AddTool(server, msi.SearchFileContent, ts.SearchFileContent)
	mcp.AddTool(server, msi.RunShellCommand, ts.RunShellCommand)
	return nil
}

func (ts *ToolSet) Close() error {
	var err error
	if ts.sftp != nil {
		err = errors.Join(err, ts.sftp.Close())
	}
	if ts.sftpCmd != nil && ts.sftpCmd.Process != nil {
		err = errors.Join(err, ts.sftpCmd.Process.Kill())
	}
	return err
}

func (ts *ToolSet) TranslateHostPath(hostPath string) (string, error) {
	if hostPath == "" {
		return "", errors.New("path is empty")
	}
	if !filepath.IsAbs(hostPath) {
		return "", fmt.Errorf("expected an absolute path, got a relative path: %#q", hostPath)
	}
	// TODO: make sure that hostPath is mounted
	return hostPath, nil
}

View on GitHub (pinned to dd909d0973)

Solutions

  1. Provide a non-empty absolute host path in the tool call argument
  2. Check the calling code for a variable that is empty at call time (unset env var, missing config field)
  3. For agents, ensure the tool schema marks path as required so the model supplies it

Example fix

// before
TranslateHostPath("")
// after
TranslateHostPath("/Users/me/project/file.txt")
Defensive patterns

Strategy: validation

Validate before calling

if hostPath == "" {
    return fmt.Errorf("cannot call tool: host path is empty")
}

Try / catch

path, err := ts.TranslateHostPath(p)
if err != nil {
    if err.Error() == "path is empty" {
        // prompt caller/agent to supply a path
    }
    return err
}

Prevention

When it happens

Trigger: Calling ListDirectory, ReadFile, WriteFile, Glob, SearchFileContent, or RunShellCommand with an empty path argument (e.g. a variable that was never populated, or an LLM agent emitting ""), which all funnel into TranslateHostPath.

Common situations: MCP client sends a tool call with the path parameter missing/defaulted to empty string; a script builds a path variable from an unset env var; an agent omits an optional path field that is actually required.

Related errors


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/70bacd76ad79b9e8. Report an issue: GitHub.