{"record":{"id":"22ee052da30d5841","repo":"Meituan-Dianping/mpvue","slug":"inline-template-components-must-have-exactly-one-c-22ee05","errorCode":null,"errorMessage":"Inline-template components must have exactly one child element.","messagePattern":"Inline-template components must have exactly one child element\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/compiler/codegen/index.js","lineNumber":314,"sourceCode":"        dir.value ? `,value:(${dir.value}),expression:${JSON.stringify(dir.value)}` : ''\n      }${\n        dir.arg ? `,arg:\"${dir.arg}\"` : ''\n      }${\n        dir.modifiers ? `,modifiers:${JSON.stringify(dir.modifiers)}` : ''\n      }},`\n    }\n  }\n  if (hasRuntime) {\n    return res.slice(0, -1) + ']'\n  }\n}\n\nfunction genInlineTemplate (el: ASTElement, state: CodegenState): ?string {\n  const ast = el.children[0]\n  if (process.env.NODE_ENV !== 'production' && (\n    el.children.length > 1 || ast.type !== 1\n  )) {\n    state.warn('Inline-template components must have exactly one child element.')\n  }\n  if (ast.type === 1) {\n    const inlineRenderFns = generate(ast, state.options)\n    return `inlineTemplate:{render:function(){${\n      inlineRenderFns.render\n    }},staticRenderFns:[${\n      inlineRenderFns.staticRenderFns.map(code => `function(){${code}}`).join(',')\n    }]}`\n  }\n}\n\nfunction genScopedSlots (\n  slots: { [key: string]: ASTElement },\n  state: CodegenState\n): string {\n  return `scopedSlots:_u([${\n    Object.keys(slots).map(key => {\n      return genScopedSlot(key, slots[key], state)","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/Meituan-Dianping/mpvue/blob/6c5d78ee04f58c6d782c456dfcf0fe63c0b7f89b/src/compiler/codegen/index.js#L296-L332","documentation":"Dev-only codegen warning from genInlineTemplate: an element with the inline-template attribute must contain exactly one element child, since that child AST becomes the component's template. Having multiple children or a text/interpolation node as the first child makes the inline template invalid and compilation of it unreliable.","triggerScenarios":"Thrown at src/compiler/codegen/index.js:314 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wrap children in one root element when using inline-template","Prefer removing inline-template and using scoped slots instead"],"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"}