{"record":{"id":"6be878cb11885796","repo":"quarkusio/quarkus","slug":"could-not-find-component-reference-6be878","errorCode":null,"errorMessage":"Could not find component reference","messagePattern":"Could not find component reference","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/devui/deployment-spi/src/main/java/io/quarkus/devui/spi/page/Page.java","lineNumber":119,"sourceCode":"            if (d.equals(this.namespace)) {\n                return id;\n            } else {\n                int i = this.namespace.indexOf(DASH) + 1;\n                String stripDevui = this.namespace.substring(i);\n                return stripDevui + DASH + id;\n            }\n        }\n        return id;\n    }\n\n    public String getComponentRef() {\n        if (internalComponent) {\n            return DOT + SLASH + DOT + DOT + SLASH + \"qwc\" + SLASH + this.componentLink;\n        } else if (this.namespace != null) {\n            return DOT + SLASH + DOT + DOT + SLASH + this.namespace + SLASH + this.componentLink;\n        }\n        // TODO: Create a not found component to display here ?\n        throw new RuntimeException(\"Could not find component reference\");\n    }\n\n    public String getNamespace() {\n        return this.namespace;\n    }\n\n    public String getNamespaceLabel() {\n        return this.namespaceLabel;\n    }\n\n    public String getIcon() {\n        return icon;\n    }\n\n    public String getColor() {\n        return color;\n    }\n","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/devui/deployment-spi/src/main/java/io/quarkus/devui/spi/page/Page.java#L101-L137","documentation":"Page.getComponentRef() computes the web-component path for the page: an internal page resolves to ./../qwc/<componentLink>, a namespaced page to ./../<namespace>/<componentLink>. If internalComponent is false and namespace is null, no reference can be built and the library throws (the planned not-found component does not exist yet).","triggerScenarios":"Calling getComponentRef() on a Page built without namespace(...) and with internalComponent=false — e.g. a page created with only a componentLink but never marked internal nor given a namespace.","commonSituations":"Custom builders or extension code constructing Page objects directly instead of via PageBuilder; external pages whose namespace assignment was skipped; migration between Quarkus versions changing how namespaces are defaulted.","solutions":["Set the namespace: pageBuilder.namespace(\"org.acme\") so the ref resolves to ./../org.acme/<componentLink>","For Dev-UI-internal components use the internal component builders (WebComponentPageBuilder/QuteDataPageBuilder) which set internalComponent=true and the qwc namespace","Build pages via PageBuilder.build() rather than constructing Page manually — build() guesses component links and namespaces","Verify any custom code copying pages preserves the namespace field"],"exampleFix":"// before\nPageBuilder pb = new WebComponentPageBuilder()\n        .componentLink(\"qwc-foo.js\");\n// getComponentRef() later throws (no namespace)\n// after\nPageBuilder pb = new WebComponentPageBuilder()\n        .namespace(\"org.acme\")\n        .componentLink(\"qwc-foo.js\");","handlingStrategy":"validation","validationCode":"if (!page.isInternalComponent() && page.getNamespace() == null) {\n    throw new IllegalStateException(\"Page needs a namespace (or internal component) before computing component ref\");\n}","typeGuard":"boolean hasComponentRef(Page p) {\n    return p != null && (p.isInternalComponent() || (p.getNamespace() != null && !p.getNamespace().isBlank()));\n}","tryCatchPattern":"try {\n    String ref = page.getComponentRef();\n} catch (RuntimeException e) {\n    if (e.getMessage().contains(\"Could not find component reference\")) {\n        log.warnf(\"Page without namespace skipped: %s\", page);\n    } else throw e;\n}","preventionTips":["Build pages through PageBuilder instead of constructing Page directly","Call namespace(...) for any non-internal page","Use internal page builders (WebComponentPageBuilder, QuteDataPageBuilder) for qwc components","Test getComponentRef() for every page your extension registers"],"tags":["devui","page","namespace","build-time"],"backgroundTag":"devui-component-reference-missing","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"}