Tencent/WeKnora · error

sandbox: create install directory: %w

Error message

sandbox: create install directory: %w

What it means

Thrown in WriteSessionFile when creating the skills image install directory in the remote sandbox fails. The MakeDir call against the sandbox provider returned an error other than an already-exists condition (which ignoreExistingDir suppresses), so the staged install file cannot be written and staging aborts with the underlying provider error wrapped.

Source

Thrown at internal/sandbox/session_manager.go:660

	if err := m.requireRemoteBackend(); err != nil {
		return err
	}
	if strings.TrimSpace(sessionID) == "" {
		return errors.New("sandbox: session ID required for file staging")
	}
	clean := path.Clean(strings.TrimSpace(filePath))
	if clean != SkillsImageRoot && !strings.HasPrefix(clean, SkillsImageRoot+"/") {
		return fmt.Errorf("sandbox: install file path %q is outside %s", filePath, SkillsImageRoot)
	}
	handle, err := m.resolveSession(ctx, sessionID)
	if err != nil {
		return err
	}
	// resetSkillDir already created this folder with mkdir -p. Cube's MakeDir
	// then reports the existing directory as an error; ignoreExistingDir keeps
	// that from aborting the seed of SKILL.md.
	if err := ignoreExistingDir(m.client.MakeDir(ctx, handle, path.Dir(clean))); err != nil {
		return fmt.Errorf("sandbox: create install directory: %w", err)
	}
	if err := m.client.WriteFile(ctx, handle, clean, content); err != nil {
		return fmt.Errorf("sandbox: write install file %s: %w", clean, err)
	}
	return nil
}

// ShellExecOptions carries per-call shell execution knobs. The install-only
// flags are explicit so skill image maintenance can write under /opt without
// loosening work_dir or user privileges for ordinary chat sessions.
type ShellExecOptions struct {
	WorkDir string
	Timeout time.Duration
	Env     map[string]string

	// AllowSkillsRoot lets installer calls work inside the skills image root.
	// See cleanSessionWorkDir for why the work_dir allowlist is lexical only.
	// Never set this from a model-authored tool such as shell_exec.

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Verify the remote sandbox is running and the session binding points to a live sandbox before staging
  2. Check provider quotas/permissions for MakeDir on the sandbox
  3. Retry the staging operation once the sandbox is healthy; inspect the wrapped cause for the root provider error
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/sandbox/session_manager.go:660 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/12c2198c47be1039. Report an issue: GitHub.