{"record":{"id":"fc9d92483f0a1c2a","repo":"parallax/jsPDF","slug":"line-join-style-of-style-is-not-recogniz","errorCode":null,"errorMessage":"Line join style of '\" + style + \"' is not recognized. See or extend .CapJoinStyles property for valid styles","messagePattern":"Line join style of '\" \\+ style \\+ \"' is not recognized\\. See or extend \\.CapJoinStyles property for valid styles","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/jspdf.js","lineNumber":5483,"sourceCode":"    return this;\n  };\n\n  var lineJoinID = 0;\n  /**\n   * Sets the line join styles.\n   * See {jsPDF.CapJoinStyles} for variants.\n   *\n   * @param {String|Number} style A string or number identifying the type of line join.\n   * @function\n   * @instance\n   * @returns {jsPDF}\n   * @memberof jsPDF#\n   * @name setLineJoin\n   */\n  API.__private__.setLineJoin = API.setLineJoin = function(style) {\n    var id = API.CapJoinStyles[style];\n    if (id === undefined) {\n      throw new Error(\n        \"Line join style of '\" +\n          style +\n          \"' is not recognized. See or extend .CapJoinStyles property for valid styles\"\n      );\n    }\n    lineJoinID = id;\n    out(id + \" j\");\n\n    return this;\n  };\n\n  var miterLimit;\n  /**\n   * Sets the miterLimit property, which effects the maximum miter length.\n   *\n   * @param {number} length The length of the miter\n   * @function\n   * @instance","sourceCodeStart":5465,"sourceCodeEnd":5501,"githubUrl":"https://github.com/parallax/jsPDF/blob/a3930ce03a585a26b2c76d12a0f413ce96f6d1a3/src/jspdf.js#L5465-L5501","documentation":"Thrown by jsPDF's setLineJoin when the style argument is not a key in the CapJoinStyles map. CapJoinStyles maps recognized style names/numbers (0/butt/miter, 1/round, 2/projecting/bevel/square) to PDF line-join operator IDs. Any value that does not resolve to a defined key (including undefined, null, misspelled strings, or numbers outside 0-2) triggers this error before the PDF 'j' operator is emitted.","triggerScenarios":"Calling doc.setLineJoin(<value>) where value is not 'miter'|'round'|'bevel'|0|1|2 (or aliases butt/rounded/circle/project/square). Passing a style intended for setLineCap (e.g. 'projecting') that is valid for caps but the lookup still resolves here too since the map is shared. Passing undefined when the style comes from an unpopulated config variable.","commonSituations":"Reading the style from a user form/config without validating; passing a camelCase variant like 'lineJoin' instead of 'miter'; passing an enum value from a different library whose numbering differs; null when an optional field is omitted.","solutions":["Pass one of the documented keys: 'miter', 'round', 'bevel' (or numeric 0, 1, 2).","If you need a custom style, extend API.CapJoinStyles with your key before calling, e.g. doc.CapJoinStyles['myjoin'] = 0.","Validate/guard the value against Object.keys(doc.CapJoinStyles) before calling setLineJoin."],"exampleFix":"// before\ndoc.setLineJoin(config.lineJoin); // config.lineJoin === 'mitred' (typo)\n// after\nvar valid = doc.CapJoinStyles;\nvar style = valid[config.lineJoin] !== undefined ? config.lineJoin : 'miter';\ndoc.setLineJoin(style);","handlingStrategy":"validation","validationCode":"var VALID_JOINS = ['miter','round','bevel',0,1,2];\nfunction isValidJoin(s){ return doc.CapJoinStyles[s] !== undefined; }\nif (isValidJoin(style)) doc.setLineJoin(style); else doc.setLineJoin('miter');","typeGuard":"function isLineJoinStyle(s){ return typeof s === 'string' || typeof s === 'number' ? Object.prototype.hasOwnProperty.call(doc.CapJoinStyles, s) : false; }","tryCatchPattern":"try { doc.setLineJoin(style); } catch (e) { if (/Line join style/.test(e.message)) doc.setLineJoin('miter'); else throw e; }","preventionTips":["Keep a whitelist constant of valid style strings","Validate config-driven values against CapJoinStyles before calling"],"tags":["jspdf","validation","line-style","argument"],"backgroundTag":null,"analyzedSha":"a3930ce03a585a26b2c76d12a0f413ce96f6d1a3","analyzedAt":"2026-08-13T05:33:39.648Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}