{"record":{"id":"343eafdc54fe4204","repo":"pentaho/pentaho-kettle","slug":"annotation","errorCode":null,"errorMessage":"Annotation","messagePattern":"Annotation","errorType":"validation","errorClass":"ArgumentRequiredError","httpStatus":null,"severity":"error","filePath":"plugins/core-ui/src/main/resources/app/pentaho/_core/module/Meta.js","lineNumber":668,"sourceCode":"     */\n    function createErrorAnnotationNotAvailable(moduleId, annotationId) {\n      return new OperationInvalidError(\n        \"The annotation '\" + annotationId + \"' is not available in module '\" + moduleId + \"'.\");\n    }\n\n    /**\n     * Gets the identifier of an annotation, given its type or its identifier.\n     *\n     * @param {Class.<pentaho.module.Annotation>|string} Annotation - The annotation class or identifier.\n     *\n     * @return {string} The annotation identifier.\n     *\n     * @throws {pentaho.lang.ArgumentRequiredError} When the `Annotation` argument is _nully_.\n     * @throws {pentaho.lang.ArgumentRequiredError} When the `Annotation` argument does not have an `id` property.\n     */\n    function getAnnotationId(Annotation) {\n      if(Annotation == null) {\n        throw new ArgumentRequiredError(\"Annotation\");\n      }\n\n      if(typeof Annotation === \"string\") {\n        return Annotation;\n      }\n\n      var annotationId = Annotation.id;\n      if(annotationId == null) {\n        throw new ArgumentRequiredError(\"Annotation.id\");\n      }\n\n      return annotationId;\n    }\n    // endregion\n  };\n});\n","sourceCodeStart":650,"sourceCodeEnd":685,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core-ui/src/main/resources/app/pentaho/_core/module/Meta.js#L650-L685","documentation":"pentaho.lang.ArgumentRequiredError thrown by getAnnotationId in Meta.js when the `Annotation` argument is nully (null or undefined). The helper needs an annotation class/id to resolve metadata and cannot proceed without it. It is surfaced through the public annotationId API.","triggerScenarios":"Calling metaService.annotationId(null), annotationId(undefined), or passing a variable that was never assigned / returned undefined from a failed lookup.","commonSituations":"Passing the result of an optional require/resolve that came back undefined; forgetting to import the annotation class; calling annotationId before module loading completed.","solutions":["Ensure the value passed to annotationId/getAnnotationId is a defined annotation class or annotation id string.","Check that the module providing the annotation resolved successfully (not undefined).","If the argument is legitimately optional, guard the call site before invoking."],"exampleFix":"// before\nvar id = metaService.annotationId(possiblyMissingAnnotation);\n// after\nif(possiblyMissingAnnotation != null) {\n  var id = metaService.annotationId(possiblyMissingAnnotation);\n}","handlingStrategy":"validation","validationCode":"if(annotation == null) throw new Error(\"annotation argument is required\");\nmetaService.annotationId(annotation);","typeGuard":"function hasAnnotation(a) { return a != null; }","tryCatchPattern":"try { id = metaService.annotationId(ann); } catch(e) { if(e.name === \"pentaho.lang.ArgumentRequiredError\") { id = null; } else { throw e; } }","preventionTips":["Never pass results of optional lookups without a null check","Import annotation classes explicitly rather than relying on globals"],"tags":["argument-required","null-argument","metadata"],"backgroundTag":"missing-required-argument","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}