{"record":{"id":"c6679803cd60ea48","repo":"quarkusio/quarkus","slug":"could-not-find-component-reference","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/Card.java","lineNumber":28,"sourceCode":"    private final String componentLink; // This is a link to the component, excluding namespace\n    private String namespace; // The namespace (a.k.a extension path)\n\n    public Card(String componentLink) {\n        if (componentLink.endsWith(DOT_JS)) {\n            this.componentLink = componentLink;\n        } else {\n            this.componentLink = componentLink + DOT_JS;\n        }\n\n        this.componentName = this.componentLink.substring(0, this.componentLink.length() - 3);\n    }\n\n    public String getComponentRef() {\n        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 void setNamespace(String namespace) {\n        this.namespace = namespace;\n    }\n\n    public String getNamespace() {\n        return this.namespace;\n    }\n\n    public String getComponentLink() {\n        return componentLink;\n    }\n\n    public String getComponentName() {\n        return componentName;\n    }\n","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/devui/deployment-spi/src/main/java/io/quarkus/devui/spi/page/Card.java#L10-L46","documentation":"Card.getComponentRef() builds the web-component path (./../<namespace>/<componentLink>) used by the Dev UI to render this card. The library throws because a Card was created with a null namespace and no fallback 'not found' component exists yet, so no valid component reference can be computed.","triggerScenarios":"Calling getComponentRef() on a Card whose namespace field was never set via setNamespace() (or a builder path that never assigned it) while the card still has a componentLink.","commonSituations":"Extension authors building custom Dev UI cards programmatically or via JSON-EJB/recorded pages and forgetting to set the namespace; cards deserialized from configuration missing the namespace field; upstream refactors that moved components between namespaces leaving stale card definitions.","solutions":["Set the namespace on the Card before rendering, e.g. card.setNamespace(\"org.acme\") so the ref resolves to ./../org.acme/<componentLink>","If the card is internal to Dev UI, use the Page-based builder (which handles the qwc internal namespace) instead of a raw Card","Verify the extension's Dev UI page builder chain (PageBuilder.namespace(...) or WebComponentPageBuilder) actually passes a namespace","Upgrade Quarkus: newer versions may provide the planned not-found component instead of throwing"],"exampleFix":"// before\nCard card = new Card();\ncard.setComponentLink(\"qwc-foo-card.js\");\nString ref = card.getComponentRef(); // throws\n// after\nCard card = new Card();\ncard.setNamespace(\"org.acme\");\ncard.setComponentLink(\"qwc-foo-card.js\");\nString ref = card.getComponentRef(); // ./../org.acme/qwc-foo-card.js","handlingStrategy":"validation","validationCode":"if (card.getNamespace() == null || card.getNamespace().isBlank()) {\n    throw new IllegalStateException(\"Card namespace must be set before computing component ref: \" + card);\n}","typeGuard":"boolean hasComponentRef(Card c) {\n    return c != null && c.getNamespace() != null && !c.getNamespace().isBlank();\n}","tryCatchPattern":"try {\n    String ref = card.getComponentRef();\n} catch (RuntimeException e) {\n    if (e.getMessage().contains(\"Could not find component reference\")) {\n        log.warnf(\"Skipping card without namespace: %s\", card);\n    } else throw e;\n}","preventionTips":["Always call setNamespace(...) (or a builder that sets it) right after creating a Card","Prefer PageBuilder-based pages over manual Card construction","Add a deployment-time test that iterates your Dev UI pages/cards and calls getComponentRef()","Keep namespace in sync when moving components between extensions"],"tags":["devui","namespace","card","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-14T00:17:10.932Z"}