{"record":{"id":"9e55aefffe2fdf3d","repo":"pentaho/pentaho-kettle","slug":"argument-pscope-p-is-required","errorCode":null,"errorMessage":"Argument ${pscope.p} is required.","messagePattern":"Argument (.+?) is required\\.","errorType":"validation","errorClass":"pentaho.lang.ArgumentRequiredError","httpStatus":null,"severity":"error","filePath":"plugins/core-ui/src/main/resources/app/pentaho/util/arg.js","lineNumber":79,"sourceCode":"\n    /**\n     * Gets the value of an required property of an object.\n     * The property is considered specified when its value is not a {@link Nully} value.\n     *\n     * @param {?object} o The object from which to get a property.\n     * @param {string} p The name of the property.\n     * @param {?string} pscope The name of the argument where the `o` is received in the caller.\n     *\n     * @return {*} The found required property value.\n     * @throws {Error} Argument required. The `o` must contain the `p`.\n     */\n    required: function(o, p, pscope) {\n      var v;\n      if(o && (v = o[p]) != null) {\n        return v;\n      }\n\n      throw new ArgumentRequiredError((pscope ? (pscope + \".\") : \"\") + p);\n    },\n\n    /**\n     * Slices the provided array.\n     *\n     * @param {object} args Array of anything.\n     * @param {number} [start=0] The index of the `args` array to begin the slice.\n     * @param {number} [end] The index of the `args` array to end the slice at.\n     *\n     * @return {Array} Array containing the elements from the `args` array between the `start` and the `end`.\n     */\n    slice: function(args, start, end) {\n      if(!args) {\n        throw new ArgumentRequiredError(\"args\");\n      }\n\n      /* eslint default-case: 0 */\n      switch(arguments.length) {","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core-ui/src/main/resources/app/pentaho/util/arg.js#L61-L97","documentation":"pentaho.util.arg.required(o, p, pscope) extracts property p from object o and throws ArgumentRequiredError with the (optionally scoped) property name when o is falsy or o[p] is null/undefined. The message interpolates the caller-supplied scope prefix, e.g. 'Argument sortSpec.field is required.'","triggerScenarios":"Calling arg.required(obj, 'prop') where obj is null/undefined, or obj.prop is null/undefined; missing nested fields flagged with a pscope prefix.","commonSituations":"API options objects missing required fields (e.g. compound filters, sort specs); config objects loaded with omitted sections; callers passing optional structs that happen to be null.","solutions":["Provide the required property before invoking the API: options.prop = value.","Validate the options object shape with arg.required (or your own checks) at entry points to fail early.","Check upstream data sources (config, server payload) that leave the field unset and add defaults."],"exampleFix":"// before\nutil.Arg.required(options, 'field', 'sortSpec'); // throws\n// after\noptions.sortSpec = options.sortSpec || {};\noptions.sortSpec.field = options.sortSpec.field || 'name';\nutil.Arg.required(options, 'field', 'sortSpec');","handlingStrategy":"validation","validationCode":"if (o == null || o[p] == null) { throw new Error('Missing ' + p + ' in options'); }\nvar v = arg.required(o, p, pscope);","typeGuard":"function hasField(o, p) { return o != null && o[p] != null; }","tryCatchPattern":"try { v = arg.required(o, p, pscope); } catch (e) { if (/is required/.test(e.message)) { v = defaultValue; } else throw e; }","preventionTips":["Validate options objects at API entry points with arg.required.","Document which option fields are mandatory and provide defaults where sensible.","Check server payloads/config for omitted sections before passing them through."],"tags":["argument-required","validation","options-object"],"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"}