{"record":{"id":"4e2827aa5f0482de","repo":"mihomo-party-org/clash-party","slug":"i18next-t-mihomo-error-profilecheckfailed","errorCode":null,"errorMessage":"${i18next.t('mihomo.error.profileCheckFailed')}:\n${allLines.join('\n')}","messagePattern":"\\$\\{i18next\\.t\\('mihomo\\.error\\.profileCheckFailed'\\)\\}:\n\\$\\{allLines\\.join\\('\n'\\)\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main/core/manager.ts","lineNumber":996,"sourceCode":"    if (error instanceof Error && 'stdout' in error) {\n      const { stdout, stderr } = error as { stdout: string; stderr?: string }\n      managerLogger.info('Profile check stdout', stdout)\n      managerLogger.info('Profile check stderr', stderr)\n\n      const errorLines = stdout\n        .split('\\n')\n        .filter((line) => line.includes('level=error') || line.includes('error'))\n        .map((line) => {\n          if (line.includes('level=error')) {\n            return line.split('level=error')[1]?.trim() || line\n          }\n          return line.trim()\n        })\n        .filter((line) => line.length > 0)\n\n      if (errorLines.length === 0) {\n        const allLines = stdout.split('\\n').filter((line) => line.trim().length > 0)\n        throw new Error(`${i18next.t('mihomo.error.profileCheckFailed')}:\\n${allLines.join('\\n')}`)\n      } else {\n        throw new Error(\n          `${i18next.t('mihomo.error.profileCheckFailed')}:\\n${errorLines.join('\\n')}`\n        )\n      }\n    } else {\n      throw new Error(`${i18next.t('mihomo.error.profileCheckFailed')}: ${error}`)\n    }\n  }\n}\n\n// 权限检查入口（从 permissions.ts 调用）\nexport async function checkAdminRestartForTun(): Promise<void> {\n  await checkAdminRestartForTunWithRestart(restartCore)\n}\n","sourceCodeStart":978,"sourceCodeEnd":1012,"githubUrl":"https://github.com/mihomo-party-org/clash-party/blob/911e090537acdf7c50bee1c3aebecc2ef119a8b5/src/main/core/manager.ts#L978-L1012","documentation":"This error is thrown by the mihomo core manager after running a profile check (config validation via the mihomo binary with `-t`). It fires when the check process exits non-zero but stderr parsing produced no distinct error lines, so the entire non-empty stdout is surfaced instead. The library throws it so users see the raw core output explaining why their profile is invalid, prefixed with a localized 'profileCheckFailed' message.","triggerScenarios":"Calling the profile check flow (e.g. checkMihomoProfile / profile validation on import or save) with a config file that makes the mihomo core fail validation (`mihomo -t` exits non-zero) while emitting its diagnostics only on stdout, not stderr (so errorLines ends up empty).","commonSituations":"Invalid YAML syntax in the subscription profile; unsupported or mistyped proxy/keyword fields; a core version change that rejects previously-valid config keys; malformed DNS or rules sections; importing a Clash (not mihomo) config with deprecated fields.","solutions":["Read the message body after the ':' — it contains the core's own stdout diagnostics pinpointing the bad line/field, and fix that in the profile YAML.","Validate the profile manually with `mihomo -t -f <config>` to reproduce the exact failure outside the app.","Re-download/refresh the subscription profile — remote subscriptions are often stale or truncated.","Update the bundled mihomo core to match the config schema version the profile targets."],"exampleFix":"// before: profile with invalid field\ntype: http\nsever: example.com   # typo\n\n// after: fix per core stdout diagnostic\ntype: http\nserver: example.com","handlingStrategy":"validation","validationCode":"// validate profile YAML before handing to the checker\nimport { parse } from 'yaml'\nconst doc = parse(profileYaml)\nif (!doc || typeof doc !== 'object' || !('proxies' in doc) || !('proxy-groups' in doc)) {\n  throw new Error('Profile must define proxies and proxy-groups')\n}","typeGuard":null,"tryCatchPattern":"try {\n  await checkProfile(configPath)\n} catch (e) {\n  const detail = String((e as Error).message).split(':\\n').slice(1).join('\\n')\n  logger.error('profile check failed', detail) // detail = raw core stdout\n}","preventionTips":["Always run `mihomo -t -f <config>` after hand-editing a profile before importing it.","Keep subscriptions machine-managed; avoid manual edits that drift from the remote schema.","Pin and update the mihomo core together with profile format versions."],"tags":["mihomo","config-validation","profile","core-check"],"backgroundTag":"config-validation-failed","analyzedSha":"911e090537acdf7c50bee1c3aebecc2ef119a8b5","analyzedAt":"2026-08-30T13:00:49.174Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}