{"record":{"id":"255d9644925220ce","repo":"gatsbyjs/gatsby","slug":"the-provided-height-of-height-is-incorrect-d","errorCode":null,"errorMessage":"The provided height of \"${height}\" is incorrect. Dimensions should be a positive number.","messagePattern":"The provided height of \"(.+?)\" is incorrect\\. Dimensions should be a positive number\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/gatsby-plugin-utils/src/polyfill-remote-file/graphql/gatsby-image-resolver.ts","lineNumber":424,"sourceCode":"  sourceMetadata: ISourceMetadata,\n  {\n    width,\n    height,\n    layout,\n    fit,\n    outputPixelDensities,\n    breakpoints,\n    aspectRatio,\n  }: CalculateImageSizesArgs\n): IImageSizes {\n  if (width && Number(width) <= 0) {\n    throw new Error(\n      `The provided width of \"${width}\" is incorrect. Dimensions should be a positive number.`\n    )\n  }\n\n  if (height && Number(height) <= 0) {\n    throw new Error(\n      `The provided height of \"${height}\" is incorrect. Dimensions should be a positive number.`\n    )\n  }\n\n  switch (layout) {\n    case `fixed`: {\n      return calculateFixedImageSizes({\n        width,\n        height,\n        fit,\n        sourceMetadata,\n        outputPixelDensities,\n        aspectRatio,\n      })\n    }\n    case `constrained`: {\n      // @ts-ignore - only width or height can be undefined but it doesn't let me type this correctly\n      return calculateResponsiveImageSizes({","sourceCodeStart":406,"sourceCodeEnd":442,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby-plugin-utils/src/polyfill-remote-file/graphql/gatsby-image-resolver.ts#L406-L442","documentation":"Thrown by calculateImageSizes when a `height` value is provided but is not a positive number. Mirrors the width check — height must be > 0 for the image transformation pipeline.","triggerScenarios":"height is truthy but Number(height) <= 0; catches height: 0, height: -50, or invalid string coercion.","commonSituations":"A query passes height: 0 accidentally, a dynamic height calculation returns a negative value, or the source plugin provides malformed metadata.","solutions":["Ensure height is a positive integer greater than 0.","Validate dynamically computed heights before passing to the resolver.","Omit height and provide width instead if only width is known.","Sanitize input: Math.max(1, height) before calling the resolver."],"exampleFix":"// before\ngatsbyImageResolver(source, { layout: 'fixed', height: 0 })\n// after\ngatsbyImageResolver(source, { layout: 'fixed', height: 200 })","handlingStrategy":"validation","validationCode":"// Sanitize height before passing to calculateImageSizes\nif (height !== undefined && height !== null) {\n  const numericHeight = Number(height)\n  if (!Number.isFinite(numericHeight) || numericHeight <= 0) {\n    throw new Error(`height must be a positive number, got ${height}`)\n  }\n}","typeGuard":"const isPositiveDimension = (val: unknown): val is number =>\n  typeof val === 'number' && val > 0 && Number.isFinite(val)","tryCatchPattern":null,"preventionTips":["Validate height is a positive finite number before image transformations.","Clamp computed heights with Math.max(1, height).","Test edge cases where layout calculations produce zero or negative heights."],"tags":["gatsby","image","validation","dimensions","sharp"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}