{"record":{"id":"553e562b22e09c04","repo":"GopeedLab/gopeed","slug":"script-file-does-not-exist-s","errorCode":null,"errorMessage":"script file does not exist: %s","messagePattern":"script file does not exist: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/download/script.go","lineNumber":64,"sourceCode":"\t\t}\n\t\tif len(paths) > 0 {\n\t\t\treturn paths\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// executeScriptAtPath executes a single script with the given data\n// Returns any error that occurred during execution\nfunc (d *Downloader) executeScriptAtPath(scriptPath string, data *ScriptData) error {\n\tif scriptPath == \"\" {\n\t\treturn fmt.Errorf(\"script path is empty\")\n\t}\n\n\t// Check if script file exists\n\tif _, err := os.Stat(scriptPath); os.IsNotExist(err) {\n\t\treturn fmt.Errorf(\"script file does not exist: %s\", scriptPath)\n\t}\n\n\t// Determine the script interpreter based on file extension\n\tvar cmd *exec.Cmd\n\text := filepath.Ext(scriptPath)\n\t\n\tswitch ext {\n\tcase \".sh\", \".bash\":\n\t\tcmd = exec.Command(\"bash\", scriptPath)\n\tcase \".py\":\n\t\tcmd = exec.Command(\"python3\", scriptPath)\n\tcase \".js\":\n\t\tcmd = exec.Command(\"node\", scriptPath)\n\tcase \".bat\", \".cmd\":\n\t\t// Windows batch files\n\t\tif runtime.GOOS == \"windows\" {\n\t\t\tcmd = exec.Command(\"cmd\", \"/c\", scriptPath)\n\t\t} else {","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/GopeedLab/gopeed/blob/7b7327ffb30816273a74b142cccc0bc10c5a4c67/pkg/download/script.go#L46-L82","documentation":"Returned by executeScriptAtPath (script.go:57-65) when a configured script hook path does not exist on disk at execution time. Scripts are fired asynchronously after download events (triggerScripts spawns executeScripts), so the failure is not raised to the download flow; it is logged as a warning with the offending path (script.go:155). The check uses os.Stat with IsNotExist, so any missing path (typo, moved file, wrong working directory) triggers it.","triggerScenarios":"DownloaderStoreConfig.Script.Paths contains a path that does not exist when DOWNLOAD_DONE/DOWNLOAD_ERROR fires: a typo, a file deleted after the config was saved, a relative path resolved against a different CWD (desktop app vs systemd/docker service), or a config synced from another machine.","commonSituations":"Absolute home-directory paths like /home/user/notify.sh that do not exist in a Docker deployment; scripts moved during refactoring without updating settings; portable installs where the config travels but the script does not; NAS environments with different mount points.","solutions":["Correct the path in the script settings to an existing file","Prefer absolute paths over relative ones so resolution does not depend on process CWD","For containers, mount the script into the container and reference the in-container path","Check the gopeed log for the 'script: failed to execute' warning to see the exact failing path"],"exampleFix":"# before (config)\n\"script\": { \"enable\": true, \"paths\": [\"notify.sh\"] }   # relative, CWD-dependent\n\n# after\n\"script\": { \"enable\": true, \"paths\": [\"/opt/gopeed/scripts/notify.sh\"] }   # absolute, mounted in container","handlingStrategy":"validation","validationCode":"for _, p := range cfg.Script.Paths {\n\tif _, err := os.Stat(p); err != nil {\n\t\treturn fmt.Errorf(\"script hook %q not found\", p)\n\t}\n}","typeGuard":null,"tryCatchPattern":"if err := d.executeScriptAtPath(path, data); err != nil {\n\tlog.Warn(\"script hook failed\", \"path\", path, \"err\", err)\n}","preventionTips":["Use absolute paths in script hook configuration","Mount script files into containers and reference the in-container path","Validate hook paths at settings-save time, not at fire time","Watch logs for 'script: failed to execute' warnings after config changes"],"tags":["script","hooks","filesystem","config"],"backgroundTag":null,"analyzedSha":"7b7327ffb30816273a74b142cccc0bc10c5a4c67","analyzedAt":"2026-08-16T02:51:03.250Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}