{"record":{"id":"7867d1fc342f8ce8","repo":"Tencent/WeKnora","slug":"script-path-q-is-a-session-workspace-file-this-s","errorCode":null,"errorMessage":"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","messagePattern":"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","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/agent/skills/manager.go","lineNumber":503,"sourceCode":"\t}, nil\n}\n\n// workspaceSkillExecuteConfig runs a session-written /workspace file with the\n// installed skill's interpreter. Preloaded (host-uploaded) skills have no\n// in-sandbox venv to attach, so those calls are rejected with a shell_exec hint.\nfunc workspaceSkillExecuteConfig(\n\tsource SkillSource,\n\tskillName, workspacePath, basePath string,\n\targs []string,\n\tstdin string,\n\tenv map[string]string,\n\tsessionID string,\n) (*sandbox.ExecuteConfig, error) {\n\tif !IsScript(workspacePath) {\n\t\treturn nil, fmt.Errorf(\"file is not an executable script: %s\", workspacePath)\n\t}\n\tif _, installed := source.(imageSkillSource); !installed {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"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\",\n\t\t\tworkspacePath,\n\t\t)\n\t}\n\tskillDir, ok := sandbox.ValidatedImageSkillDir(basePath)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"cannot run workspace script %q for skill %q: no installed skill directory\", workspacePath, skillName)\n\t}\n\tenv[skillDirEnvVar] = skillDir\n\treturn &sandbox.ExecuteConfig{\n\t\tRemoteScriptPath: workspacePath,\n\t\tSkillDir:         skillDir,\n\t\tArgs:             args,\n\t\tStdin:            stdin,\n\t\tEnv:              env,\n\t\tSessionID:        sessionID,\n\t}, nil\n}","sourceCodeStart":485,"sourceCodeEnd":521,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/agent/skills/manager.go#L485-L521","documentation":"A session /workspace script can only be run via execute_skill_script when the named skill is installed in the sandbox image, because the run attaches the skill's in-image environment (venv, SKILL_DIR). For preloaded/host-only skills there is no in-sandbox environment to attach, so the call is rejected with guidance to use shell_exec or a skill-relative path.","triggerScenarios":"Calling execute_skill_script with a /workspace/... script path while the referenced skill resolves to a preloaded (non-imageSkillSource) source — e.g. running /workspace/my.py against a skill that exists only on the host.","commonSituations":"Workspace deployed with preloaded skills but no image-installed skills; model conflates 'skill is available' with 'skill is in the image'; after switching sandbox images the skill is no longer baked in.","solutions":["Run the workspace script with shell_exec instead of execute_skill_script","Pass a skill-relative path for a skill that IS installed in the image","Install/bake the skill into the sandbox image if its environment is required","Verify with SandboxSkillDir/GetSkillInfo that the skill is image-installed before using workspace paths"],"exampleFix":"// before\nmgr.ExecuteScript(ctx, \"preloaded-skill\", \"/workspace/run.py\", nil, \"\")\n// after\nsandboxExec(ctx, \"shell_exec\", map[string]any{\"command\": \"python /workspace/run.py\"})","handlingStrategy":"fallback","validationCode":"if _, ok := mgr.SandboxSkillDir(skillName); !ok {\n    // skill not in image: use shell_exec for /workspace scripts\n}","typeGuard":"func skillInImage(m *skills.Manager, name string) bool {\n    _, ok := m.SandboxSkillDir(name)\n    return ok\n}","tryCatchPattern":"_, err := mgr.ExecuteScript(ctx, skill, wsPath, args, stdin)\nif err != nil && strings.Contains(err.Error(), \"session workspace file\") {\n    return shellExec(ctx, \"python \"+wsPath) // fallback\n}\nreturn err","preventionTips":["Use skill-relative paths for skills; shell_exec for ad-hoc workspace scripts","Verify image-install status before workspace-path execution","Bake required skills into the sandbox image when their venv is needed","Keep prompt/tool docs clear about the preloaded-vs-image distinction"],"tags":["go","workspace","image","skill-install"],"backgroundTag":"skill-not-installed-in-image","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}