{"record":{"id":"11a6b2f16072d8ba","repo":"apache/flink","slug":"corrupt-artifact-fetching-state","errorCode":null,"errorMessage":"Corrupt artifact fetching state.","messagePattern":"Corrupt artifact fetching state\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"warning","filePath":"flink-clients/src/main/java/org/apache/flink/client/program/artifact/ArtifactFetchManager.java","lineNumber":107,"sourceCode":"     */\n    public Result fetchArtifacts(String[] uris) {\n        checkArgument(uris != null && uris.length > 0, \"At least one URI is required.\");\n\n        List<File> artifacts =\n                Arrays.stream(uris)\n                        .map(FunctionUtils.uncheckedFunction(this::fetchArtifact))\n                        .collect(Collectors.toList());\n\n        if (artifacts.size() > 1) {\n            return new Result(null, artifacts);\n        }\n\n        if (artifacts.size() == 1) {\n            return new Result(artifacts.get(0), null);\n        }\n\n        // Should not happen.\n        throw new IllegalStateException(\"Corrupt artifact fetching state.\");\n    }\n\n    /**\n     * Fetches the job jar and any additional artifact if the given list is not null or empty.\n     *\n     * @param jobUri URI of the job jar\n     * @param additionalUris URI(s) of any additional artifact to fetch\n     * @return result with the fetched artifacts\n     * @throws Exception\n     */\n    public Result fetchArtifacts(@Nullable String jobUri, @Nullable List<String> additionalUris)\n            throws Exception {\n        File jobJar = jobUri == null ? null : fetchArtifact(jobUri);\n        List<File> additionalArtifacts =\n                additionalUris == null\n                        ? Collections.emptyList()\n                        : additionalUris.stream()\n                                .map(FunctionUtils.uncheckedFunction(this::fetchArtifact))","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-clients/src/main/java/org/apache/flink/client/program/artifact/ArtifactFetchManager.java#L89-L125","documentation":"An internal defensive guard thrown when fetchArtifacts(String[] uris) ends up with zero artifacts after the stream pipeline, despite the precondition requiring at least one URI. The comment 'Should not happen' indicates this is an unreachable-state assertion. It signals a logic bug in the artifact fetching pipeline rather than a user error.","triggerScenarios":"Theoretically unreachable: the method checks uris.length > 0, maps each to a File, and the collect should always produce at least one result. Firing would indicate the stream pipeline silently dropped an element (e.g., a filter or exception was swallowed).","commonSituations":"This should not occur in practice. If it does, it points to a bug in fetchArtifact returning null (despite its signature) or a custom Collector dropping elements.","solutions":["Report this as a Flink bug — the state should be unreachable given the preconditions.","Check if a custom ArtifactFetcher or FunctionUtils.uncheckedFunction wrapper is silently dropping exceptions.","Verify the uris array is not being modified concurrently.","Inspect the logs for any swallowed exceptions during fetchArtifact calls."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    Result result = fetchManager.fetchArtifacts(uris);\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"Corrupt artifact fetching state\")) {\n        // report as Flink bug; this state should be unreachable\n    }\n    throw e;\n}","preventionTips":["Report this error to Flink developers with full context — it indicates an internal bug.","Keep Flink version up to date to benefit from fixes to the artifact pipeline."],"tags":["artifact-fetch","internal","unreachable","assertion"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}