{"record":{"id":"c69b7aedee03231d","repo":"apache/flink","slug":"the-gpu-discovery-script-does-not-exist-in-path-s","errorCode":null,"errorMessage":"The gpu discovery script does not exist in path %s.","messagePattern":"The gpu discovery script does not exist in path (.+?)\\.","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"flink-external-resources/flink-external-resource-gpu/src/main/java/org/apache/flink/externalresource/gpu/GPUDriver.java","lineNumber":83,"sourceCode":"        if (StringUtils.isNullOrWhitespaceOnly(discoveryScriptPathStr)) {\n            throw new IllegalConfigurationException(\n                    String.format(\n                            \"GPU discovery script ('%s') is not configured.\",\n                            ExternalResourceOptions.genericKeyWithSuffix(\n                                    DISCOVERY_SCRIPT_PATH.key())));\n        }\n\n        Path discoveryScriptPath = Paths.get(discoveryScriptPathStr);\n        if (!discoveryScriptPath.isAbsolute()) {\n            discoveryScriptPath =\n                    Paths.get(\n                            System.getenv().getOrDefault(ConfigConstants.ENV_FLINK_HOME_DIR, \".\"),\n                            discoveryScriptPathStr);\n        }\n        discoveryScriptFile = discoveryScriptPath.toFile();\n\n        if (!discoveryScriptFile.exists()) {\n            throw new FileNotFoundException(\n                    String.format(\n                            \"The gpu discovery script does not exist in path %s.\",\n                            discoveryScriptFile.getAbsolutePath()));\n        }\n        if (!discoveryScriptFile.canExecute()) {\n            throw new FlinkException(\n                    String.format(\n                            \"The discovery script %s is not executable.\",\n                            discoveryScriptFile.getAbsolutePath()));\n        }\n\n        args = config.get(DISCOVERY_SCRIPT_ARG);\n    }\n\n    @Override\n    public Set<GPUInfo> retrieveResourceInfo(long gpuAmount) throws Exception {\n        Preconditions.checkArgument(\n                gpuAmount > 0,","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-external-resources/flink-external-resource-gpu/src/main/java/org/apache/flink/externalresource/gpu/GPUDriver.java#L65-L101","documentation":"Thrown by the GPU external resource driver (GPUDriver) during TaskManager startup when the configured GPU discovery script cannot be found on disk. The path comes from the config option 'external-resources.<name>.gpu.discovery-script.path' (default: gpuDiscoveryScript.sh under FLINK_HOME). Relative paths are resolved against the FLINK_HOME environment variable (or '.' if unset), so a wrong FLINK_HOME also produces this error.","triggerScenarios":"Constructing GPUDriver (via ExternalResourceUtils setup at TaskManager start) with a discovery-script path that does not point to an existing file: bad absolute path, relative path resolved against a missing/wrong FLINK_HOME, or the script not shipped inside the Flink distribution/container image.","commonSituations":"Running Flink in Docker/Kubernetes where FLINK_HOME differs from the node setup; custom discovery script configured in flink-conf.yaml but never copied to workers; typo in the config key value; running from an IDE where FLINK_HOME is not set so '.' is used.","solutions":["Verify the configured 'external-resources.<name>.discovery-script.path' (note: the key is under the generic external-resources prefix) points to a real file on every TaskManager","If the path is relative, confirm FLINK_HOME is set and the script exists relative to it, or switch to an absolute path","Ship the script with the Flink distribution or bake it into the container image and mount it read-only","Check the absolute path echoed in the error message ('does not exist in path <abs>') to see where Flink actually looked"],"exampleFix":"# before (flink-conf.yaml)\nexternal-resources: gpu\nexternal-resources.gpu.discovery-script.path: scripts/gpu-discovery.sh\n\n# after\nexternal-resources: gpu\nexternal-resources.gpu.discovery-script.path: /opt/flink/scripts/gpu-discovery.sh","handlingStrategy":"validation","validationCode":"// before constructing/using the GPU driver, verify the script resolves\nString script = config.get(GPUDriverOptions.DISCOVERY_SCRIPT_PATH());\njava.nio.file.Path p = java.nio.file.Paths.get(script);\nif (!p.isAbsolute()) {\n    String home = System.getenv().getOrDefault(\"FLINK_HOME\", \".\");\n    p = java.nio.file.Paths.get(home, script);\n}\njava.util.Objects.requireNonNull(p.toFile().exists(),\n    \"GPU discovery script missing at \" + p.toAbsolutePath());","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use absolute paths for the discovery script in flink-conf.yaml","Add a container image check that fails fast if the script file is absent","Set and verify FLINK_HOME on all nodes before relying on relative paths"],"tags":["gpu","external-resources","configuration","file-not-found"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}