pentaho/pentaho-kettle · error · ArgumentRequiredError

Annotation.id

Error message

Annotation.id

What it means

pentaho.lang.ArgumentRequiredError thrown by getAnnotationId when the passed Annotation object has no `id` property (undefined or null). Since the annotation is an object (not a string), the library reads `.id` to identify it and treats a missing id as a required argument violation nested under `Annotation.id`.

Solutions

  1. Declare an `id` on the annotation class via its Annotation specification.
  2. Pass the annotation id string directly instead of the class object.
  3. Verify you are passing the annotation class, not an arbitrary object.

Example fix

// before
var MyAnno = Annotation.extend({});
metaService.annotationId(MyAnno);
// after
var MyAnno = Annotation.extend({ id: "my/annotation" });
metaService.annotationId(MyAnno); // or annotationId("my/annotation")
Defensive patterns

Strategy: validation

Validate before calling

if(Annotation != null && typeof Annotation !== "string" && Annotation.id == null) {
  throw new Error("Annotation class must declare an id");
}

Type guard

function isAnnotationWithId(a) { return typeof a === "string" || (a != null && a.id != null); }

Try / catch

try { id = metaService.annotationId(ann); } catch(e) { if(e.name === "pentaho.lang.ArgumentRequiredError") { console.warn("annotation missing id", ann); id = null; } else { throw e; } }

Prevention

When it happens

Trigger: Passing an anonymous or malformed object (e.g. a plain {} or a class created without declaring `id` via Annotation(...) specification) to annotationId/getAnnotationId.

Common situations: Defining a custom annotation class but forgetting to declare its `id`; passing the wrong object (an instance instead of the annotation class); typos in the id property name.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/aaa2dc4b4f252e90. Report an issue: GitHub.

Appendix: source

Thrown at plugins/core-ui/src/main/resources/app/pentaho/_core/module/Meta.js:677

     * @param {Class.<pentaho.module.Annotation>|string} Annotation - The annotation class or identifier.
     *
     * @return {string} The annotation identifier.
     *
     * @throws {pentaho.lang.ArgumentRequiredError} When the `Annotation` argument is _nully_.
     * @throws {pentaho.lang.ArgumentRequiredError} When the `Annotation` argument does not have an `id` property.
     */
    function getAnnotationId(Annotation) {
      if(Annotation == null) {
        throw new ArgumentRequiredError("Annotation");
      }

      if(typeof Annotation === "string") {
        return Annotation;
      }

      var annotationId = Annotation.id;
      if(annotationId == null) {
        throw new ArgumentRequiredError("Annotation.id");
      }

      return annotationId;
    }
    // endregion
  };
});

View on GitHub (pinned to f3058517a1)