{"record":{"id":"e6a69ca67ccefa84","repo":"Tencent/WeKnora","slug":"file-is-not-an-executable-script-s","errorCode":null,"errorMessage":"file is not an executable script: %s","messagePattern":"file is not an executable script: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/agent/skills/manager.go","lineNumber":452,"sourceCode":"\tskillName, scriptPath, basePath string,\n\targs []string,\n\tstdin string,\n\tenv map[string]string,\n\tsessionID string,\n) (*sandbox.ExecuteConfig, error) {\n\tif workspace, ok := sandbox.RunnableWorkspaceScript(scriptPath); ok {\n\t\treturn workspaceSkillExecuteConfig(source, skillName, workspace, basePath, args, stdin, env, sessionID)\n\t}\n\n\timage, installed := source.(imageSkillSource)\n\tif !installed {\n\t\t// Load the script file to verify it exists and is a script\n\t\tfile, err := source.LoadSkillFile(skillName, scriptPath)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to load script: %w\", err)\n\t\t}\n\t\tif !file.IsScript {\n\t\t\treturn nil, fmt.Errorf(\"file is not an executable script: %s\", scriptPath)\n\t\t}\n\t\treturn &sandbox.ExecuteConfig{\n\t\t\tScript:    file.Path,\n\t\t\tArgs:      args,\n\t\t\tWorkDir:   basePath,\n\t\t\tStdin:     stdin,\n\t\t\tEnv:       env,\n\t\t\tSessionID: sessionID,\n\t\t}, nil\n\t}\n\n\t// The archive is deliberately not consulted: the image is what executes,\n\t// and a skill whose archive failed to store is still installed and\n\t// runnable. That leaves the extension as the only check available here,\n\t// which is also the one the executor's interpreter choice depends on.\n\tif !IsScript(scriptPath) {\n\t\treturn nil, fmt.Errorf(\"file is not an executable script: %s\", scriptPath)\n\t}","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/agent/skills/manager.go#L434-L470","documentation":"For preloaded (non-image) skills, after successfully loading the file the manager checks SkillFile.IsScript; a file that exists but is not an executable script (wrong extension, e.g. .md, .txt, .json) is rejected. The interpreter/executor can only be chosen for recognized script extensions.","triggerScenarios":"Manager.ExecuteScript on a preloaded skill with a skill-relative path that resolves to a data/doc file rather than a .py/.sh/etc. script — e.g. passing 'README.md' or a config JSON as scriptPath.","commonSituations":"The model or caller points execute_skill_script at a documentation or data file inside the skill; skill author shipped a script with an unsupported extension; confusion between reading a file (load_skill_file) and executing it.","solutions":["Pass a path to a file with a supported executable extension (.py, .sh, etc.)","Use the file-reading tool for documentation/data files instead of execute_skill_script","Rename/convert the file to a supported script type inside the skill, or add the extension if it was stripped","Check IsScript/extension rules in the skills package to confirm supported types"],"exampleFix":"// before\nmgr.ExecuteScript(ctx, \"pdf\", \"docs/README.md\", nil, \"\")\n// after\nmgr.ExecuteScript(ctx, \"pdf\", \"scripts/extract.py\", nil, \"\")","handlingStrategy":"validation","validationCode":"if !skills.IsScript(scriptPath) {\n    return fmt.Errorf(\"refusing to execute non-script %s\", scriptPath)\n}","typeGuard":"func isExecutableScript(path string) bool { return skills.IsScript(path) }","tryCatchPattern":"_, err := mgr.ExecuteScript(ctx, skill, path, args, stdin)\nif err != nil && strings.Contains(err.Error(), \"file is not an executable script\") {\n    // read the file with the file tool instead of executing\n}\nreturn err","preventionTips":["Only pass paths with supported script extensions to execute_skill_script","Use the file-reading tool for docs/data inside skills","Check skills.IsScript before calling ExecuteScript programmatically","Keep scripts with standard extensions (.py, .sh) in skill packages"],"tags":["go","script","validation","file-type"],"backgroundTag":"not-an-executable-script","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}