{"record":{"id":"1b05abd1ac414faa","repo":"github/copilot-sdk","slug":"missing-version-resource-ensure-maven-resource","errorCode":null,"errorMessage":"Missing version resource:  — ensure Maven resource filtering has run (mvn process-resources)","messagePattern":"Missing version resource:  — ensure Maven resource filtering has run \\(mvn process-resources\\)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"java/sdk/src/main/java/com/github/copilot/ffi/NativeRuntimeLoader.java","lineNumber":252,"sourceCode":"        }\n        throw new IOException(\"Copilot CLI executable not found at \" + cliPath\n                + \" — the classifier JAR must contain both runtime.node and the copilot binary\");\n    }\n\n    /**\n     * Reads the SDK version from the filtered {@code copilot-runtime.properties}\n     * resource.\n     *\n     * @return the version string\n     * @throws IOException\n     *             if the resource cannot be read\n     * @throws IllegalStateException\n     *             if the resource is missing or the version property is blank\n     */\n    static String readVersion(ClassLoader loader) throws IOException {\n        URL resource = loader.getResource(VERSION_RESOURCE);\n        if (resource == null) {\n            throw new IllegalStateException(\"Missing version resource: \" + VERSION_RESOURCE\n                    + \" — ensure Maven resource filtering has run (mvn process-resources)\");\n        }\n        Properties props = new Properties();\n        try (InputStream in = resource.openStream()) {\n            props.load(in);\n        }\n        String version = props.getProperty(\"version\");\n        if (version == null || version.isBlank()) {\n            throw new IllegalStateException(\"Blank or missing 'version' property in \" + VERSION_RESOURCE\n                    + \" — check Maven resource filtering configuration\");\n        }\n        return version;\n    }\n\n    private static String readNativePackageVersion(ClassLoader loader, String classifier) throws IOException {\n        String resourcePath = \"native/\" + classifier + \"/\" + PLATFORM_PROPERTIES_FILENAME;\n        URL resource = loader.getResource(resourcePath);\n        if (resource == null) {","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/java/sdk/src/main/java/com/github/copilot/ffi/NativeRuntimeLoader.java#L234-L270","documentation":"readVersion() could not find the copilot-runtime.properties resource on the classpath. This file is produced by Maven resource filtering at build time and carries the SDK version used as the cache key, so its absence means the SDK was built or packaged incorrectly.","triggerScenarios":"Running code from a build where `mvn process-resources` never ran or filtering was disabled; copying classes into a JAR manually; the resource was excluded by packaging config; running from an IDE with an unfiltered target/classes.","commonSituations":"First `mvn compile` in a fresh clone without resource filtering enabled for copilot-runtime.properties; custom build (Gradle, Bazel) that doesn't replicate Maven filtering; shaded JAR excluding *.properties; corrupted incremental build.","solutions":["Run a clean full build: mvn clean process-resources (or mvn clean install).","Enable Maven resource filtering on the directory containing copilot-runtime.properties in pom.xml (<filtering>true</filtering>).","Check packaging/shade config isn't excluding copilot-runtime.properties from the final JAR.","If using a non-Maven build, generate copilot-runtime.properties with a `version` property equivalent to the filtered output."],"exampleFix":"// before (pom.xml): filtering disabled\n<resource>\n  <directory>src/main/resources</directory>\n</resource>\n\n// after\n<resource>\n  <directory>src/main/resources</directory>\n  <filtering>true</filtering>\n</resource>","handlingStrategy":"validation","validationCode":"boolean versionResourcePresent = NativeRuntimeLoader.class.getClassLoader()\n    .getResource(\"copilot-runtime.properties\") != null;\nif (!versionResourcePresent) throw new IllegalStateException(\"Run 'mvn clean process-resources' — copilot-runtime.properties missing\");\n","typeGuard":null,"tryCatchPattern":"try {\n    Path runtime = NativeRuntimeLoader.resolve();\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"Missing version resource\")) {\n        throw new IllegalStateException(\"Build artifact is broken: rebuild with Maven resource filtering (mvn clean install)\", e);\n    } else throw e;\n}","preventionTips":["Always build the SDK with a full mvn clean install so filtering runs.","Enable <filtering>true</filtering> for the resource directory containing copilot-runtime.properties.","Verify built JARs contain a concrete version in copilot-runtime.properties before publishing.","In IDEs, run the Maven process-resources phase or import via the Maven lifecycle, not raw javac."],"tags":["maven","build","classpath","versioning"],"backgroundTag":"missing-config-file","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}