{"record":{"id":"1c4ce4a05c448097","repo":"Meituan-Dianping/mpvue","slug":"createstream-cannot-be-called-without-a-template","errorCode":null,"errorMessage":"createStream cannot be called without a template.","messagePattern":"createStream cannot be called without a template\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/server/template-renderer/index.js","lineNumber":229,"sourceCode":"      return needed.filter(isJS).map(file => {\n        return `<script src=\"${this.publicPath}/${file}\" defer></script>`\n      }).join('')\n    } else {\n      return ''\n    }\n  }\n\n  getUsedAsyncFiles (context: Object): ?Array<string> {\n    if (!context._mappedFiles && context._registeredComponents && this.mapFiles) {\n      context._mappedFiles = this.mapFiles(Array.from(context._registeredComponents))\n    }\n    return context._mappedFiles\n  }\n\n  // create a transform stream\n  createStream (context: ?Object): TemplateStream {\n    if (!this.parsedTemplate) {\n      throw new Error('createStream cannot be called without a template.')\n    }\n    return new TemplateStream(this, this.parsedTemplate, context || {})\n  }\n}\n\nfunction getPreloadType (ext: string): string {\n  if (ext === 'js') {\n    return 'script'\n  } else if (ext === 'css') {\n    return 'style'\n  } else if (/jpe?g|png|svg|gif|webp|ico/.test(ext)) {\n    return 'image'\n  } else if (/woff2?|ttf|otf|eot/.test(ext)) {\n    return 'font'\n  } else {\n    // not exhausting all possbilities here, but above covers common cases\n    return ''\n  }","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/Meituan-Dianping/mpvue/blob/6c5d78ee04f58c6d782c456dfcf0fe63c0b7f89b/src/server/template-renderer/index.js#L211-L247","documentation":"Generic guard thrown by TemplateRenderer.createStream when parsedTemplate is undefined, i.e. the renderer was built without a template. Streaming interpolation requires a parsed HTML template with the content placeholder; calling createStream on a template-less renderer cannot work.","triggerScenarios":"Thrown at src/server/template-renderer/index.js:229 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create the renderer with a template: createBundleRenderer(bundle, { template })","Use renderer.renderToStream without a TemplateRenderer if no template is needed","Check that the template file loaded successfully before constructing the renderer"],"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"}