{"record":{"id":"e941d211ee39ecaa","repo":"quarkusio/quarkus","slug":"unable-to-find-file-referenced-in-propertykey","errorCode":null,"errorMessage":"Unable to find file referenced in '${propertyKey}=${classpathFile}'. Remove property or add file to your path.","messagePattern":"Unable to find file referenced in '(.+?)=(.+?)'\\. Remove property or add file to your path\\.","errorType":"exception","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"extensions/hibernate-search-backend-elasticsearch-common/deployment/src/main/java/io/quarkus/hibernate/search/backend/elasticsearch/common/deployment/HibernateSearchBackendElasticsearchProcessor.java","lineNumber":142,"sourceCode":"                applicationArchivesBuildItem, nativeImageResources, hotDeploymentWatchedFiles);\n    }\n\n    private static void registerClasspathFileFromConfig(MapperContext mapperContext, String backendName, String indexName,\n            String propertyKeyRadical,\n            Optional<String> classpathFileOptional,\n            ApplicationArchivesBuildItem applicationArchivesBuildItem,\n            BuildProducer<NativeImageResourceBuildItem> nativeImageResources,\n            BuildProducer<HotDeploymentWatchedFileBuildItem> hotDeploymentWatchedFiles) {\n        if (!classpathFileOptional.isPresent()) {\n            return;\n        }\n        String classpathFile = classpathFileOptional.get();\n\n        Path existingPath = applicationArchivesBuildItem.getRootArchive().getChildPath(classpathFile);\n\n        if (existingPath == null || Files.isDirectory(existingPath)) {\n            //raise exception if explicit file is not present (i.e. not the default)\n            throw new ConfigurationException(\n                    \"Unable to find file referenced in '\"\n                            + mapperContext.backendPropertyKey(backendName, indexName, propertyKeyRadical) + \"=\"\n                            + classpathFile\n                            + \"'. Remove property or add file to your path.\");\n        }\n        nativeImageResources.produce(new NativeImageResourceBuildItem(classpathFile));\n        hotDeploymentWatchedFiles.produce(new HotDeploymentWatchedFileBuildItem(classpathFile));\n    }\n\n}\n","sourceCodeStart":124,"sourceCodeEnd":153,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/hibernate-search-backend-elasticsearch-common/deployment/src/main/java/io/quarkus/hibernate/search/backend/elasticsearch/common/deployment/HibernateSearchBackendElasticsearchProcessor.java#L124-L153","documentation":"When a config property references a classpath file (e.g. an Elasticsearch analysis or index-settings JSON file), the extension resolves it against the application archive during the build. registerClasspathFileFromConfig throws this ConfigurationException if the referenced path cannot be found under the application root, or if it resolves to a directory instead of a file. This prevents silently shipping a broken native-image resource reference.","triggerScenarios":"At build time: a property like quarkus.hibernate-search-orm.elasticsearch.schema-management.index-defaults or analysis config file property is set to a classpath path (classpathFile) that either does not exist under the application archive root or points at a directory (existingPath == null || Files.isDirectory(existingPath)).","commonSituations":"Typo in the resource path; file placed in a module not on the application archive (wrong src/main/resources location); file excluded from the native image; accidentally pointing at a directory instead of a file; renaming/moving resource files without updating config.","solutions":["Place the referenced file under src/main/resources at exactly the path given in the property and rebuild","Correct the property value to the existing file's classpath path (check spelling and leading slashes)","If the file is not needed, remove the property as the message suggests","Verify the path points to a file, not a directory, and that the file is included when building a native image"],"exampleFix":"// before\nquarkus.hibernate-search-orm.elasticsearch.schema-management.analysis-configurer=analysis/analyzers.json\n// after (file actually at src/main/resources/elasticsearch/analyzers.json)\nquarkus.hibernate-search-orm.elasticsearch.schema-management.analysis-configurer=elasticsearch/analyzers.json","handlingStrategy":"validation","validationCode":"// Verify resource exists before referencing it in config:\nvar url = Thread.currentThread().getContextClassLoader().getResource(\"elasticsearch/analyzers.json\");\nif (url == null || url.toString().endsWith(\"/\")) {\n  throw new IllegalStateException(\"Referenced Hibernate Search analysis file missing from classpath\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Put referenced files under src/main/resources with paths matching config exactly","Verify resources exist after adding them (mvn clean then check target/classes)","For native builds, confirm the resource is bundled (it is registered as a NativeImageResourceBuildItem once found)"],"tags":["quarkus","hibernate-search","elasticsearch","classpath-resource","build-time"],"backgroundTag":"classpath-resource-not-found","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}