parallax/jsPDF · error · Error
Line join style of '" + style + "' is not recognized. See or
Error message
Line join style of '" + style + "' is not recognized. See or extend .CapJoinStyles property for valid styles
What it means
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.
Source
Thrown at src/jspdf.js:5483
return this;
};
var lineJoinID = 0;
/**
* Sets the line join styles.
* See {jsPDF.CapJoinStyles} for variants.
*
* @param {String|Number} style A string or number identifying the type of line join.
* @function
* @instance
* @returns {jsPDF}
* @memberof jsPDF#
* @name setLineJoin
*/
API.__private__.setLineJoin = API.setLineJoin = function(style) {
var id = API.CapJoinStyles[style];
if (id === undefined) {
throw new Error(
"Line join style of '" +
style +
"' is not recognized. See or extend .CapJoinStyles property for valid styles"
);
}
lineJoinID = id;
out(id + " j");
return this;
};
var miterLimit;
/**
* Sets the miterLimit property, which effects the maximum miter length.
*
* @param {number} length The length of the miter
* @function
* @instanceView on GitHub (pinned to a3930ce03a)
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.
Example fix
// before doc.setLineJoin(config.lineJoin); // config.lineJoin === 'mitred' (typo) // after var valid = doc.CapJoinStyles; var style = valid[config.lineJoin] !== undefined ? config.lineJoin : 'miter'; doc.setLineJoin(style);
Defensive patterns
Strategy: validation
Validate before calling
var VALID_JOINS = ['miter','round','bevel',0,1,2];
function isValidJoin(s){ return doc.CapJoinStyles[s] !== undefined; }
if (isValidJoin(style)) doc.setLineJoin(style); else doc.setLineJoin('miter'); Type guard
function isLineJoinStyle(s){ return typeof s === 'string' || typeof s === 'number' ? Object.prototype.hasOwnProperty.call(doc.CapJoinStyles, s) : false; } Try / catch
try { doc.setLineJoin(style); } catch (e) { if (/Line join style/.test(e.message)) doc.setLineJoin('miter'); else throw e; } Prevention
- Keep a whitelist constant of valid style strings
- Validate config-driven values against CapJoinStyles before calling
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid argument passed to jsPDF.setLineMiterLimit
- Invalid coordinates passed to jsPDF.addSvgAsImage
- Invalid measurements (width and/or height) passed to jsPDF.a
- Invalid arguments passed to PubSub.subscribe (jsPDF-module)
- Invalid Combination of fontweight and fontstyle
AI-assisted analysis of parallax/jsPDF@a3930ce03a (2026-08-13).
Data as JSON: /api/errors/fc9d92483f0a1c2a.
Report an issue: GitHub.