mihomo-party-org/clash-party · error

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

Error message

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

What it means

This is the primary branch of the profile-check failure in the mihomo core manager: the `mihomo -t` validation run exited non-zero and stderr yielded non-empty error lines, so those lines are joined and thrown after a localized 'profileCheckFailed' prefix. It represents a concrete, diagnosed config error reported by the mihomo core itself.

Source

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

      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. Inspect the error lines after the ':\n' — they name the exact field/line the core rejected; correct them in the profile.
  2. Run `mihomo -t -f <config>` yourself to iterate on fixes quickly.
  3. Re-fetch the subscription if the profile is remotely managed and locally hand-edited.
  4. Align core version with the profile schema (upgrade mihomo core or downgrade the profile format).

Example fix

// before
tab-indented:
	key: value

// after: YAML forbids tabs for indentation
spaced:
  key: value
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-validate common schema pitfalls before the core check
if (/\t/.test(profileYaml)) throw new Error('YAML must not use tabs for indentation')
const doc = parse(profileYaml)
for (const g of doc['proxy-groups'] ?? []) {
  for (const p of g.proxies ?? []) {
    if (!doc.proxies?.some((x: any) => x.name === p) && !doc['proxy-groups']?.some((x: any) => x.name === p)) {
      throw new Error(`Group "${g.name}" references unknown proxy "${p}"`)
    }
  }
}

Try / catch

try {
  await checkProfile(configPath)
} catch (e) {
  const lines = String((e as Error).message).split('\n').slice(1)
  // first line after prefix holds the core's specific stderr complaint
  showErrorDialog(lines.join('\n'))
}

Prevention

When it happens

Trigger: Running the profile check (on profile import, save, or manual re-check) with a config the mihomo core rejects; the core prints its specific complaint(s) to stderr, producing one or more errorLines that get embedded in the thrown message.

Common situations: Typo'd keys in proxies/proxy-groups; referencing a proxy in a group that doesn't exist; invalid port/UUID values; unsupported rule syntax; profiles written for an older Clash core version; hand-edited YAML with tab indentation.

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/5092108a474831ab. Report an issue: GitHub.