Tencent/WeKnora · error

cannot run workspace script %q for skill %q: no installed sk

Error message

cannot run workspace script %q for skill %q: no installed skill directory

What it means

For a workspace script run against an image-installed skill, the skill's base path must pass sandbox.ValidatedImageSkillDir (i.e. resolve to a real, validated installed skill directory in the image). An empty or invalid basePath means there is no installed directory to attach, so the run is refused.

Source

Thrown at internal/agent/skills/manager.go:510

	source SkillSource,
	skillName, workspacePath, basePath string,
	args []string,
	stdin string,
	env map[string]string,
	sessionID string,
) (*sandbox.ExecuteConfig, error) {
	if !IsScript(workspacePath) {
		return nil, fmt.Errorf("file is not an executable script: %s", workspacePath)
	}
	if _, installed := source.(imageSkillSource); !installed {
		return nil, fmt.Errorf(
			"script_path %q is a session workspace file; this skill is not installed in the sandbox image, so execute_skill_script cannot attach its environment. Run it with shell_exec, or pass a skill-relative path such as scripts/foo.py",
			workspacePath,
		)
	}
	skillDir, ok := sandbox.ValidatedImageSkillDir(basePath)
	if !ok {
		return nil, fmt.Errorf("cannot run workspace script %q for skill %q: no installed skill directory", workspacePath, skillName)
	}
	env[skillDirEnvVar] = skillDir
	return &sandbox.ExecuteConfig{
		RemoteScriptPath: workspacePath,
		SkillDir:         skillDir,
		Args:             args,
		Stdin:            stdin,
		Env:              env,
		SessionID:        sessionID,
	}, nil
}

// sessionFileStoreFromManager returns the sandbox manager's effective
// session filesystem capability, or nil when the backend cannot expose one.
// Isolated in a helper so callers stay free of provider-specific branches.
func sessionFileStoreFromManager(mgr sandbox.Manager) sandbox.SessionFileStore {
	provider, ok := mgr.(sandbox.SessionCapabilityProvider)
	if !ok || provider == nil {

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Rebuild/reinstall the sandbox image so the skill directory actually exists at the expected path
  2. Verify GetSkillBasePath returns a non-empty valid directory for the skill
  3. Check sandbox.ValidatedImageSkillDir requirements (path shape/existence) against the configured basePath
  4. Fall back to shell_exec for the workspace script while the install is broken

Example fix

// before
basePath, _ := source.GetSkillBasePath(skillName) // returns "" -> error later
// after
if dir, ok := mgr.SandboxSkillDir(skillName); !ok || dir == "" {
    return fmt.Errorf("skill %s not installed in image; use shell_exec", skillName)
}
Defensive patterns

Strategy: try-catch

Validate before calling

dir, ok := mgr.SandboxSkillDir(skillName)
if !ok || dir == "" {
    return fmt.Errorf("skill %s has no installed image dir", skillName)
}

Type guard

func hasValidImageDir(m *skills.Manager, name string) bool {
    dir, ok := m.SandboxSkillDir(name)
    return ok && strings.TrimSpace(dir) != ""
}

Try / catch

_, err := mgr.ExecuteScript(ctx, skill, wsPath, args, stdin)
if err != nil && strings.Contains(err.Error(), "no installed skill directory") {
    // reinstall image or fall back to shell_exec
}
return err

Prevention

When it happens

Trigger: Manager.ExecuteScript with a /workspace script path where the skill reports itself as image-installed but basePath from GetSkillBasePath is empty or fails validation — e.g. corrupt/missing install record, image without the skill directory despite metadata claiming it.

Common situations: Image build skipped or pruned the skill directory while skill metadata remained; path validation failing (empty dir, path traversal); stale metadata after image rebuild.

Related errors


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