{"record":{"id":"18c1783c88b048de","repo":"remotion-dev/remotion","slug":"solid-pixeldensity-must-be-a-positive-finite","errorCode":null,"errorMessage":"<Solid>: `pixelDensity` must be a positive finite number. Received: ${String(pixelDensity)}.","messagePattern":"<Solid>: `pixelDensity` must be a positive finite number\\. Received: (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/effects/Solid.tsx","lineNumber":60,"sourceCode":"type OptionalProps = {\n\treadonly color: string | undefined;\n\treadonly effects: EffectsProp;\n\treadonly className: string | undefined;\n\treadonly style: React.CSSProperties | undefined;\n\treadonly pixelDensity: number | undefined;\n};\n\nconst resolveSolidPixelDensity = (pixelDensity: number | undefined): number => {\n\tif (pixelDensity === undefined) {\n\t\treturn 1;\n\t}\n\n\tif (\n\t\ttypeof pixelDensity !== 'number' ||\n\t\t!Number.isFinite(pixelDensity) ||\n\t\tpixelDensity <= 0\n\t) {\n\t\tthrow new Error(\n\t\t\t`<Solid>: \\`pixelDensity\\` must be a positive finite number. Received: ${String(pixelDensity)}.`,\n\t\t);\n\t}\n\n\treturn pixelDensity;\n};\n\ntype InnerSolidProps = MandatoryProps &\n\tOptionalProps & {\n\t\toverrideId: string | null;\n\t};\nexport type SolidProps = MandatoryProps &\n\tPartial<OptionalProps> &\n\tInteractiveCropProps;\n\nexport const solidSchema = {\n\t...baseSchema,\n\tcolor: {","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/effects/Solid.tsx#L42-L78","documentation":"The <Solid> effect component accepts an optional pixelDensity that scales the internal canvas resolution (useful for high-DPI output). The value must be a positive, finite number; undefined defaults to 1. Non-numbers, NaN, Infinity, zero, and negatives are rejected because they would produce an invalid or non-renderable canvas size.","triggerScenarios":"Passing <Solid pixelDensity={0} />, pixelDensity={-1}, pixelDensity={NaN}, pixelDensity={Infinity}, pixelDensity={'2'}, or a value computed from a division that can yield NaN/Infinity.","commonSituations":"Computing pixelDensity from window.devicePixelRatio (which can be 0 in some headless contexts); passing a string from a config; arithmetic that occasionally divides by zero.","solutions":["Omit pixelDensity to use the default of 1.","Pass a positive finite literal like pixelDensity={2}.","Clamp/validate computed values: Math.max(0.0001, Number(density)) and ensure it is finite before passing."],"exampleFix":"// before\n<Solid pixelDensity={density} ... /> // density may be 0/NaN\n\n// after\n<Solid\n  pixelDensity={\n    typeof density === 'number' && Number.isFinite(density) && density > 0\n      ? density\n      : undefined\n  }\n  ...\n/>","handlingStrategy":"validation","validationCode":"const safeDensity =\n  typeof pixelDensity === 'number' &&\n  Number.isFinite(pixelDensity) &&\n  pixelDensity > 0\n    ? pixelDensity\n    : undefined;","typeGuard":"const isValidPixelDensity = (d: unknown): d is number =>\n  typeof d === 'number' && Number.isFinite(d) && d > 0;","tryCatchPattern":null,"preventionTips":["Omit pixelDensity to use the default (1).","Validate computed densities (from devicePixelRatio etc.) before passing.","Clamp density to a safe positive range at the source."],"tags":["effects","solid","validation","canvas","props"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}