{"record":{"id":"bc1657ba503308dd","repo":"remotion-dev/remotion","slug":"no-src-prop-was-passed-to-img","errorCode":null,"errorMessage":"No \"src\" prop was passed to <Img>.","messagePattern":"No \"src\" prop was passed to <Img>\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/Img.tsx","lineNumber":376,"sourceCode":"\tfrom,\n\ttrimBefore,\n\tdurationInFrames,\n\tfreeze,\n\tpremountFor,\n\tpostmountFor,\n\tstyle,\n\tstyleWhilePremounted,\n\tstyleWhilePostmounted,\n\tcropLeft,\n\tcropRight,\n\tcropTop,\n\tcropBottom,\n\tcontrols,\n\toutlineRef: refForOutline,\n\t...props\n}) => {\n\tif (!src) {\n\t\tthrow new Error('No \"src\" prop was passed to <Img>.');\n\t}\n\n\tconst {\n\t\teffectivePostmountFor,\n\t\teffectivePremountFor,\n\t\tfreezeFrame,\n\t\tisPremountingOrPostmounting,\n\t\tpostmountingActive,\n\t\tpremountingActive,\n\t\tpremountingStyle,\n\t} = usePremounting({\n\t\tfrom: from ?? 0,\n\t\tdurationInFrames: durationInFrames ?? Infinity,\n\t\tpremountFor: premountFor ?? null,\n\t\tpostmountFor: postmountFor ?? null,\n\t\tstyle: style ?? null,\n\t\tstyleWhilePremounted: styleWhilePremounted ?? null,\n\t\tstyleWhilePostmounted: styleWhilePostmounted ?? null,","sourceCodeStart":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/Img.tsx#L358-L394","documentation":"Thrown by the NativeImgInner component (the path <Img> takes when no `effects` prop is passed) when `src` is falsy. <Img> always requires a `src` because it is responsible for suspending rendering until the image is decoded; an undefined src would silently produce a blank frame. This is the validation guard at the top of the native-rendering branch of <Img>.","triggerScenarios":"Rendering `<Img />` without a src prop; passing `src={undefined}` while a value loads; destructuring an object that lacks the src field; passing src from a state variable that is initialized to undefined.","commonSituations":"Loading images from props where the field is optional; CMS data where the URL field can be empty; conditional rendering forgotten when the asset is missing.","solutions":["Always pass a valid `src` string URL to <Img>.","Defer rendering: `{url && <Img src={url} />}` so the component never mounts without src.","Provide a placeholder image URL as a fallback.","Validate upstream data sources to ensure the src field is non-empty before passing to <Img>."],"exampleFix":"// before\n{props.image && <Img alt={props.image.alt} />}\n// after\n{props.image?.url && <Img src={props.image.url} alt={props.image.alt} />}","handlingStrategy":"type-guard","validationCode":"if (typeof src !== 'string' || src.length === 0) {\n  throw new Error(`Missing <Img> src`);\n}\nreturn <Img src={src} />;","typeGuard":"const isNonEmptyString = (v: unknown): v is string =>\n  typeof v === 'string' && v.trim().length > 0;","tryCatchPattern":null,"preventionTips":["Conditionally render <Img> only when src is truthy.","Provide a placeholder src as a fallback.","Type the src prop as `string` (not optional) in your wrappers.","Validate CMS/JSON image fields before forwarding to <Img>."],"tags":["img","src","props","validation"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}