{"record":{"id":"6daa02c6bf02da43","repo":"JuliusBrussee/caveman","slug":"hermes-plugins-enabled-uses-inline-yaml-refusing","errorCode":null,"errorMessage":"Hermes plugins.enabled uses inline YAML; refusing unsafe native merge","messagePattern":"Hermes plugins\\.enabled uses inline YAML; refusing unsafe native merge","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/index.ts","lineNumber":6726,"sourceCode":"  if (new Set(routeIndexes.map((index) => lines[index]!.match(/^  ([^:]+):/)?.[1])).size !== routeIndexes.length) {\n    throw new Error(\"Hermes model provider/base_url keys are duplicated; refusing ambiguous install\");\n  }\n  const insertAt = routeIndexes[0] ?? model.start + 1;\n  for (const index of [...routeIndexes].sort((a, b) => b - a)) lines.splice(index, 1);\n  const routeBlock = [\n    `  ${HERMES_NATIVE_ROUTE_BEGIN}`,\n    '  provider: \"custom\"',\n    `  base_url: ${yamlQuote(appendUrlPath(gw, \"/w/hermes\"))}`,\n    `  ${HERMES_NATIVE_ROUTE_END}`,\n  ];\n  lines.splice(insertAt, 0, ...routeBlock);\n\n  let pluginBlock: string | null = null;\n  const plugins = topLevelSection(lines, \"plugins\");\n  if (plugins) {\n    let enabled = -1;\n    for (let i = plugins.start + 1; i < plugins.end; i++) {\n      if (/^  enabled:\\s*\\[/.test(lines[i]!)) throw new Error(\"Hermes plugins.enabled uses inline YAML; refusing unsafe native merge\");\n      if (/^  enabled:\\s*(?:#.*)?$/.test(lines[i]!)) { enabled = i; break; }\n    }\n    if (enabled >= 0) {\n      if (!hermesNamedPluginEnabled(source, HERMES_NATIVE_PLUGIN_NAME)) {\n        const block = [`    ${HERMES_NATIVE_PLUGIN_BEGIN}`, `    - ${HERMES_NATIVE_PLUGIN_NAME}`, `    ${HERMES_NATIVE_PLUGIN_END}`];\n        lines.splice(enabled + 1, 0, ...block);\n        pluginBlock = block.join(\"\\n\");\n      }\n    } else {\n      const block = [`  ${HERMES_NATIVE_PLUGIN_BEGIN}`, \"  enabled:\", `    - ${HERMES_NATIVE_PLUGIN_NAME}`, `  ${HERMES_NATIVE_PLUGIN_END}`];\n      lines.splice(plugins.start + 1, 0, ...block);\n      pluginBlock = block.join(\"\\n\");\n    }\n  } else {\n    if (lines.length > 0 && lines[lines.length - 1]!.trim()) lines.push(\"\");\n    const block = [HERMES_NATIVE_PLUGIN_BEGIN, \"plugins:\", \"  enabled:\", `    - ${HERMES_NATIVE_PLUGIN_NAME}`, HERMES_NATIVE_PLUGIN_END];\n    lines.push(...block);\n    pluginBlock = block.join(\"\\n\");","sourceCodeStart":6708,"sourceCodeEnd":6744,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/cli/src/index.ts#L6708-L6744","documentation":"hermesNativeConfig() needs to append its plugin name to `plugins.enabled`, which it can only do as a YAML block list (`enabled:` followed by `- name` lines). An inline flow-style array (`enabled: [a, b]`) cannot be safely line-merged, so it throws and asks the user to expand it first.","triggerScenarios":"Native Hermes install when the config contains a line matching /^  enabled:\\s*\\[/ inside the plugins: section.","commonSituations":"Compact hand-written configs using flow-style YAML; snippets copied from docs that use inline arrays; generators emitting flow style.","solutions":["Expand plugins.enabled to block-list form in the Hermes config","Re-run the caveman hermes install"],"exampleFix":"# before\nplugins:\n  enabled: [shell, git]\n\n# after\nplugins:\n  enabled:\n    - shell\n    - git","handlingStrategy":"validation","validationCode":"import { readFileSync } from \"node:fs\";\nfunction hermesEnabledNotInline(path: string): boolean {\n  try { return !readFileSync(path, \"utf8\").split(/\\r?\\n/).some((l) => /^  enabled:\\s*\\[/.test(l)); }\n  catch { return true; }\n}","typeGuard":null,"tryCatchPattern":"try { nativeInstallHermes(); } catch (e) {\n  if (e instanceof Error && /plugins.enabled uses inline YAML/.test(e.message)) {\n    expandEnabledToBlockList(); nativeInstallHermes();\n  } else throw e;\n}","preventionTips":["Write list keys in block style, not flow style [a, b]","Avoid one-line compact configs for tools whose configs get line-merged","Normalize YAML style before invoking installers"],"tags":["hermes","yaml","inline-scalar","merge-safety"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}