babalae/better-genshin-impact · error · Exception

地脉花类型无效,请重新选择

Error message

地脉花类型无效,请重新选择

What it means

Thrown by ValidateSettings when LeyLineOutcropType is set to a value that is neither '启示之花' (blossoms of revelation) nor '藏金之花' (blossoms of wealth). These are the only two ley line blossom types in Genshin Impact and the only two the automation supports. Any other string value — including localized variants, English equivalents, or typos — is rejected.

Source

Thrown at BetterGenshinImpact/GameTask/AutoLeyLineOutcrop/AutoLeyLineOutcropTask.cs:186

        _systemInfo = TaskContext.Instance().SystemInfo;
        _tpTask = new TpTask(_ct);
        ValidateSettings();
        LoadConfigData();
        LoadRecognitionObjects();
    }

    private void ValidateSettings()
    {
        _taskParam.FightConfig ??= new AutoLeyLineOutcropFightConfig();

        if (string.IsNullOrWhiteSpace(_taskParam.LeyLineOutcropType))
        {
            throw new Exception("地脉花类型未选择");
        }

        if (_taskParam.LeyLineOutcropType != "启示之花" && _taskParam.LeyLineOutcropType != "藏金之花")
        {
            throw new Exception("地脉花类型无效,请重新选择");
        }

        if (string.IsNullOrWhiteSpace(_taskParam.Country))
        {
            throw new Exception("国家未配置");
        }

        if (!string.IsNullOrWhiteSpace(_taskParam.FriendshipTeam) && string.IsNullOrWhiteSpace(_taskParam.Team))
        {
            throw new Exception("配置好感队时必须配置战斗队伍");
        }

        if (_taskParam.Count < 1)
        {
            _taskParam.Count = 1;
        }

        if (string.IsNullOrWhiteSpace(_taskParam.FightConfig.StrategyName) && _taskParam.Timeout > 0)

View on GitHub (pinned to a7cb36712d)

Solutions

  1. Set LeyLineOutcropType to exactly '启示之花' or '藏金之花' (Simplified Chinese, no trailing spaces).
  2. If using the UI, re-select the type from the dropdown rather than typing it manually.
  3. Check the configuration file for full-width characters or invisible whitespace.

Example fix

// before
taskParam.LeyLineOutcropType = "启示之花 "; // trailing space

// after
taskParam.LeyLineOutcropType = "启示之花";
Defensive patterns

Strategy: validation

Validate before calling

// Before starting, validate the ley line type value
var validTypes = new[] { "启示之花", "藏金之花" };
if (!validTypes.Contains(taskParam.LeyLineOutcropType))
{
    Logger.LogError("地脉花类型无效,请选择 启示之花 或 藏金之花");
    return;
}

Type guard

public static bool IsValidLeyLineType(string type)
{
    return type == "启示之花" || type == "藏金之花";
}

Prevention

When it happens

Trigger: LeyLineOutcropType was assigned a non-whitespace string that does not exactly match one of the two supported Chinese names. Common causes: a trailing space, full-width vs half-width characters, an English value like 'Revelation', or an outdated value from an older config schema.

Common situations: Configuration file edited by hand with a wrong value; a UI dropdown was changed to a custom/free-text entry; the value was copied from a localization other than Simplified Chinese; a version update changed the expected values.

Related errors


AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13). Data as JSON: /api/errors/834e8eb092d61005. Report an issue: GitHub.