mihomo-party-org/clash-party · error

${i18next.t('mihomo.error.profileCheckFailed')}: ${allLines.

Error message

${i18next.t('mihomo.error.profileCheckFailed')}:
${allLines.join('
')}

What it means

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.

Source

Thrown at src/main/core/manager.ts:996

    if (error instanceof Error && 'stdout' in error) {
      const { stdout, stderr } = error as { stdout: string; stderr?: string }
      managerLogger.info('Profile check stdout', stdout)
      managerLogger.info('Profile check stderr', stderr)

      const errorLines = stdout
        .split('\n')
        .filter((line) => line.includes('level=error') || line.includes('error'))
        .map((line) => {
          if (line.includes('level=error')) {
            return line.split('level=error')[1]?.trim() || line
          }
          return line.trim()
        })
        .filter((line) => line.length > 0)

      if (errorLines.length === 0) {
        const allLines = stdout.split('\n').filter((line) => line.trim().length > 0)
        throw new Error(`${i18next.t('mihomo.error.profileCheckFailed')}:\n${allLines.join('\n')}`)
      } else {
        throw new Error(
          `${i18next.t('mihomo.error.profileCheckFailed')}:\n${errorLines.join('\n')}`
        )
      }
    } else {
      throw new Error(`${i18next.t('mihomo.error.profileCheckFailed')}: ${error}`)
    }
  }
}

// 权限检查入口(从 permissions.ts 调用)
export async function checkAdminRestartForTun(): Promise<void> {
  await checkAdminRestartForTunWithRestart(restartCore)
}

View on GitHub (pinned to 911e090537)

Solutions

  1. 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.
  2. Validate the profile manually with `mihomo -t -f <config>` to reproduce the exact failure outside the app.
  3. Re-download/refresh the subscription profile — remote subscriptions are often stale or truncated.
  4. Update the bundled mihomo core to match the config schema version the profile targets.

Example fix

// before: profile with invalid field
type: http
sever: example.com   # typo

// after: fix per core stdout diagnostic
type: http
server: example.com
Defensive patterns

Strategy: validation

Validate before calling

// validate profile YAML before handing to the checker
import { parse } from 'yaml'
const doc = parse(profileYaml)
if (!doc || typeof doc !== 'object' || !('proxies' in doc) || !('proxy-groups' in doc)) {
  throw new Error('Profile must define proxies and proxy-groups')
}

Try / catch

try {
  await checkProfile(configPath)
} catch (e) {
  const detail = String((e as Error).message).split(':\n').slice(1).join('\n')
  logger.error('profile check failed', detail) // detail = raw core stdout
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.

Related errors


AI-assisted analysis of mihomo-party-org/clash-party@911e090537 (2026-08-30). Data as JSON: /api/errors/4e2827aa5f0482de. Report an issue: GitHub.