{"record":{"id":"5190311457c58096","repo":"hexojs/hexo","slug":"no-input-file-or-string","errorCode":null,"errorMessage":"No input file or string!","messagePattern":"No input file or string!","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"lib/hexo/render.ts","lineNumber":106,"sourceCode":"      return Reflect.apply(renderer, ctx, [data, options]);\n    }).then(result => {\n      result = toString(result, data);\n      if (data.onRenderEnd) {\n        return data.onRenderEnd(result);\n      }\n\n      return result;\n    }).then(result => {\n      const output = this.getOutput(ext) || ext;\n      return ctx.execFilter(`after_render:${output}`, result, {\n        context: ctx,\n        args: [data]\n      });\n    }).asCallback(callback);\n  }\n\n  renderSync(data: StoreFunctionData, options = {}): any {\n    if (!data) throw new TypeError('No input file or string!');\n\n    const ctx = this.context;\n\n    if (data.text == null) {\n      if (!data.path) throw new TypeError('No input file or string!');\n      data.text = readFileSync(data.path);\n    }\n\n    if (data.text == null) throw new TypeError('No input file or string!');\n\n    const ext = data.engine || getExtname(data.path);\n    let result;\n\n    if (ext && this.isRenderableSync(ext)) {\n      const renderer = this.getRendererSync(ext);\n      result = Reflect.apply(renderer, ctx, [data, options]);\n    } else {\n      result = data.text;","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/hexojs/hexo/blob/059cb17494d0632a053c24077f5bcb6ae92acc51/lib/hexo/render.ts#L88-L124","documentation":"First guard in Render.renderSync() (lib/hexo/render.ts:106). renderSync synchronously renders either an inline string (data.text) or a file (data.path). It rejects a falsy data argument outright (null, undefined, 0, '', false) because there is no input to render.","triggerScenarios":"Calling hexo.render.renderSync(null), renderSync(undefined), or omitting the argument entirely; a code path where the data object was conditionally built and resolved to undefined; passing a string directly instead of wrapping it in { text }.","commonSituations":"Refactor that made the data object optional; confusion between renderSync(string) and renderSync({ text: string }); optional chaining producing undefined (maybeData && renderSync(maybeData)) when maybeData is null.","solutions":["Pass a StoreFunctionData object: renderSync({ text: '...', engine: 'markdown' }) or renderSync({ path: '...' }).","Ensure the variable holding data is defined before the call (typeof data === 'object').","If you only have a string, wrap it: renderSync({ text: str, engine: 'md' })."],"exampleFix":"// before\nhexo.render.renderSync(maybeInput);\n\n// after\nif (maybeInput) hexo.render.renderSync(maybeInput);","handlingStrategy":"type-guard","validationCode":"if (!data || typeof data !== 'object') {\n  throw new TypeError('renderSync requires a data object with text or path');\n}\nhexo.render.renderSync(data);","typeGuard":"const isRenderData = (v: unknown): v is { text?: string; path?: string; engine?: string } =>\n  v != null && typeof v === 'object' && ('text' in v || 'path' in v);","tryCatchPattern":null,"preventionTips":["Wrap inline strings as { text, engine } before calling renderSync.","Type the data argument as StoreFunctionData so missing fields fail to compile.","Avoid optional chaining that can pass undefined into renderSync."],"tags":["render","type-validation","sync","renderer"],"backgroundTag":null,"analyzedSha":"059cb17494d0632a053c24077f5bcb6ae92acc51","analyzedAt":"2026-08-12T20:52:05.731Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}