{"record":{"id":"9ec0f60eea6a70c6","repo":"Meituan-Dianping/mpvue","slug":"rendersync-cannot-be-called-without-a-template","errorCode":null,"errorMessage":"renderSync cannot be called without a template.","messagePattern":"renderSync cannot be called without a template\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/server/template-renderer/index.js","lineNumber":84,"sourceCode":"      // initial async chunk mapping\n      this.mapFiles = createMapper(clientManifest)\n    }\n  }\n\n  bindRenderFns (context: Object) {\n    const renderer: any = this\n    ;['ResourceHints', 'State', 'Scripts', 'Styles'].forEach(type => {\n      context[`render${type}`] = renderer[`render${type}`].bind(renderer, context)\n    })\n    // also expose getPreloadFiles, useful for HTTP/2 push\n    context.getPreloadFiles = renderer.getPreloadFiles.bind(renderer, context)\n  }\n\n  // render synchronously given rendered app content and render context\n  renderSync (content: string, context: ?Object) {\n    const template = this.parsedTemplate\n    if (!template) {\n      throw new Error('renderSync cannot be called without a template.')\n    }\n    context = context || {}\n    if (this.inject) {\n      return (\n        template.head(context) +\n        (context.head || '') +\n        this.renderResourceHints(context) +\n        this.renderStyles(context) +\n        template.neck(context) +\n        content +\n        this.renderState(context) +\n        this.renderScripts(context) +\n        template.tail(context)\n      )\n    } else {\n      return (\n        template.head(context) +\n        template.neck(context) +","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/Meituan-Dianping/mpvue/blob/6c5d78ee04f58c6d782c456dfcf0fe63c0b7f89b/src/server/template-renderer/index.js#L66-L102","documentation":"Generic guard thrown by TemplateRenderer.renderSync when the renderer was constructed without a template option. renderSync needs a parsed HTML template to interpolate the rendered app content and context into; without one there is nothing to inject into, so the call is invalid rather than a runtime failure.","triggerScenarios":"Thrown at src/server/template-renderer/index.js:84 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a template (file path or HTML string) when creating the renderer: createRenderer({ template })","For no-template usage, call renderToString/renderToStream directly instead of renderSync","Verify the template option is not undefined due to a failed fs.readFileSync"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c5d78ee04f58c6d782c456dfcf0fe63c0b7f89b","analyzedAt":"2026-09-02T05:17:40.946Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}