{"record":{"id":"c8a154c328e2fc68","repo":"quarkusio/quarkus","slug":"cardtext-requires-either-statictext-dynamictext","errorCode":null,"errorMessage":"CardText requires either staticText(), dynamicText(), or streamingText()","messagePattern":"CardText requires either staticText\\(\\), dynamicText\\(\\), or streamingText\\(\\)","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/devui/deployment-spi/src/main/java/io/quarkus/devui/spi/page/CardTextBuilder.java","lineNumber":47,"sourceCode":"\n    public CardTextBuilder dynamicText(String jsonRpcMethodName) {\n        this.dynamicText = jsonRpcMethodName;\n        return this;\n    }\n\n    public CardTextBuilder streamingText(String jsonRpcMultiMethodName) {\n        this.streamingText = jsonRpcMultiMethodName;\n        return this;\n    }\n\n    public CardTextBuilder streamingTextParams(String... params) {\n        this.streamingTextParams = params;\n        return this;\n    }\n\n    public CardText build() {\n        if (staticText == null && dynamicText == null && streamingText == null) {\n            throw new RuntimeException(\"CardText requires either staticText(), dynamicText(), or streamingText()\");\n        }\n        String joinedParams = null;\n        if (streamingTextParams != null && streamingTextParams.length > 0) {\n            joinedParams = String.join(\",\", streamingTextParams);\n        }\n        return new CardText(title, icon, staticText, dynamicText, streamingText, joinedParams);\n    }\n}\n","sourceCodeStart":29,"sourceCodeEnd":56,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/devui/deployment-spi/src/main/java/io/quarkus/devui/spi/page/CardTextBuilder.java#L29-L56","documentation":"CardTextBuilder.build() requires at least one content source: staticText(...), dynamicText(...), or streamingText(...). A CardText with no content source would render an empty card, so the builder refuses to construct it.","triggerScenarios":"Calling CardTextBuilder.build() with none of staticText/dynamicText/streamingText set (all still null), e.g. title/icon only.","commonSituations":"Extension authors building text cards for the Dev UI and forgetting the fluent content call; using dynamicText with a method name but mistyping the builder method so the field stays null; conditional branches that set text only in one path.","solutions":["Call one of staticText(\"...\"), dynamicText(\"rpcMethodName\"), or streamingText(\"rpcMethodName\") before build()","For server-computed text prefer dynamicText pointing at a @JsonRpc method; for constant text use staticText","If content may be absent, skip adding the CardText to the page instead of building an empty one","Check your fluent chain — a broken chain (e.g. calling build() on a new builder instead of the configured one) silently drops earlier setters"],"exampleFix":"// before\nCardText text = new CardTextBuilder()\n        .title(\"Version\")\n        .build(); // throws\n// after\nCardText text = new CardTextBuilder()\n        .title(\"Version\")\n        .staticText(\"1.0.0\")\n        .build();","handlingStrategy":"validation","validationCode":"if (staticText == null && dynamicText == null && streamingText == null) {\n    throw new IllegalStateException(\"CardTextBuilder needs staticText(), dynamicText(), or streamingText()\");\n}","typeGuard":"boolean hasContent(CardText t) {\n    return t != null && (t.getStaticText() != null || t.getDynamicText() != null || t.getStreamingText() != null);\n}","tryCatchPattern":"try {\n    return textBuilder.build();\n} catch (RuntimeException e) {\n    if (e.getMessage().contains(\"CardText requires\")) {\n        return textBuilder.staticText(\"n/a\").build();\n    }\n    throw e;\n}","preventionTips":["Always call one content setter (staticText/dynamicText/streamingText) before build()","Prefer the isXContent()-style convenience patterns where offered","Check the fluent chain actually flows into build() on the same builder instance","Guard dynamic content sources so a missing RPC method does not leave the field null"],"tags":["devui","card-text","validation","build-time"],"backgroundTag":"missing-required-argument","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"}