{"record":{"id":"fd9bb47f3b1b116d","repo":"lovell/sharp","slug":"only-gaussian-noise-is-supported-at-the-moment","errorCode":null,"errorMessage":"Only gaussian noise is supported at the moment","messagePattern":"Only gaussian noise is supported at the moment","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/input.mjs","lineNumber":356,"sourceCode":"        inputDescriptor.createChannels = inputOptions.create.channels;\n        inputDescriptor.createPageHeight = 0;\n        if (is.defined(inputOptions.create.pageHeight)) {\n          if (is.integer(inputOptions.create.pageHeight) && inputOptions.create.pageHeight > 0 && inputOptions.create.pageHeight <= inputOptions.create.height) {\n            if (inputOptions.create.height % inputOptions.create.pageHeight !== 0) {\n              throw new Error(`Expected create.height ${inputOptions.create.height} to be a multiple of create.pageHeight ${inputOptions.create.pageHeight}`);\n            }\n            inputDescriptor.createPageHeight = inputOptions.create.pageHeight;\n          } else {\n            throw is.invalidParameterError('create.pageHeight', 'positive integer', inputOptions.create.pageHeight);\n          }\n        }\n        // Noise\n        if (is.defined(inputOptions.create.noise)) {\n          if (!is.object(inputOptions.create.noise)) {\n            throw new Error('Expected noise to be an object');\n          }\n          if (inputOptions.create.noise.type !== 'gaussian') {\n            throw new Error('Only gaussian noise is supported at the moment');\n          }\n          inputDescriptor.createNoiseType = inputOptions.create.noise.type;\n          if (!is.inRange(inputOptions.create.channels, 1, 4)) {\n            throw is.invalidParameterError('create.channels', 'number between 1 and 4', inputOptions.create.channels);\n          }\n          inputDescriptor.createNoiseMean = 128;\n          if (is.defined(inputOptions.create.noise.mean)) {\n            if (is.number(inputOptions.create.noise.mean) && is.inRange(inputOptions.create.noise.mean, 0, 10000)) {\n              inputDescriptor.createNoiseMean = inputOptions.create.noise.mean;\n            } else {\n              throw is.invalidParameterError('create.noise.mean', 'number between 0 and 10000', inputOptions.create.noise.mean);\n            }\n          }\n          inputDescriptor.createNoiseSigma = 30;\n          if (is.defined(inputOptions.create.noise.sigma)) {\n            if (is.number(inputOptions.create.noise.sigma) && is.inRange(inputOptions.create.noise.sigma, 0, 10000)) {\n              inputDescriptor.createNoiseSigma = inputOptions.create.noise.sigma;\n            } else {","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/lovell/sharp/blob/56676c69180a32b468123e090f87bfee30539b49/lib/input.mjs#L338-L374","documentation":"Thrown when create.noise.type is defined but is not the string 'gaussian'. Sharp's noise generator currently implements only gaussian noise, so any other type value (including typos like 'Gaussian' with wrong case, 'uniform', 'random', or a non-string) is rejected. The check is a strict inequality against 'gaussian'.","triggerScenarios":"noise: { type: 'uniform' }, noise: { type: 'Gaussian' } (capital G), noise: { type: 'random' }, or noise: { type: 0 }.","commonSituations":"Assuming other distributions are supported. Case-sensitivity surprises. Auto-completing or guessing the type name. Copying from a tutorial that referenced an unsupported noise kind.","solutions":["Use exactly noise: { type: 'gaussian' } (lowercase).","If you need a different distribution, generate the noise buffer yourself and pass it as raw input.","Double-check the spelling and case against the docs."],"exampleFix":"// before\nsharp({ create: { width: 100, height: 100, channels: 3, noise: { type: 'uniform' } } })\n\n// after\nsharp({ create: { width: 100, height: 100, channels: 3, noise: { type: 'gaussian', mean: 128, sigma: 30 } } })","handlingStrategy":"validation","validationCode":"function gaussianCreate(opts) {\n  if (opts.noise && opts.noise.type !== 'gaussian') {\n    throw new Error(`Unsupported noise type '${opts.noise.type}'; only 'gaussian' is supported`);\n  }\n  return sharp({ create: opts });\n}","typeGuard":"function isSupportedNoiseType(type) {\n  return type === 'gaussian';\n}","tryCatchPattern":null,"preventionTips":["Use exactly 'gaussian' (lowercase).","For other distributions, generate the buffer externally and pass it as raw input.","Check the docs before assuming a distribution is supported."],"tags":["create","noise","input","validation","unsupported-feature"],"backgroundTag":null,"analyzedSha":"56676c69180a32b468123e090f87bfee30539b49","analyzedAt":"2026-08-13T04:44:31.201Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}