babalae/better-genshin-impact · error · Exception

地脉花类型未选择

Error message

地脉花类型未选择

What it means

Thrown by AutoLeyLineOutcropTask.ValidateSettings when _taskParam.LeyLineOutcropType is null, empty, or whitespace. ValidateSettings runs during Initialize (called at the top of Start) and is the first validation gate. LeyLineOutcropType determines which ley line blossom variant ('启示之花' for blossoms of revelation, '藏金之花' for blossoms of wealth) the task will seek. Without it the task cannot select the correct map markers or template images.

Source

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

        }
    }

    private void Initialize()
    {
        _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)

View on GitHub (pinned to a7cb36712d)

Solutions

  1. Select either '启示之花' or '藏金之花' in the ley line task configuration UI before starting.
  2. If constructing AutoLeyLineOutcropParam programmatically, set taskParam.LeyLineOutcropType = "启示之花" or "藏金之花".
  3. Validate the configuration file / script that feeds the param to ensure LeyLineOutcropType is present.

Example fix

// before
var param = new AutoLeyLineOutcropParam();
// LeyLineOutcropType never set
var task = new AutoLeyLineOutcropTask(param);

// after
var param = new AutoLeyLineOutcropParam
{
    LeyLineOutcropType = "启示之花",
    Country = "蒙德"
};
var task = new AutoLeyLineOutcropTask(param);
Defensive patterns

Strategy: validation

Validate before calling

// Before starting, validate the ley line type is set
if (string.IsNullOrWhiteSpace(taskParam.LeyLineOutcropType))
{
    Logger.LogError("请选择地脉花类型(启示之花或藏金之花)");
    return;
}

Type guard

public static bool HasValidLeyLineType(AutoLeyLineOutcropParam param)
{
    return !string.IsNullOrWhiteSpace(param.LeyLineOutcropType);
}

Prevention

When it happens

Trigger: The task was started with an AutoLeyLineOutcropParam where LeyLineOutcropType was never set — typically when launched from a script, scheduler, or one-dragon mode that did not populate the field from the UI selection.

Common situations: User started the task without selecting a ley line type in the configuration UI; a JSON/script configuration omitted the LeyLineOutcropType field; the param was constructed programmatically with defaults and the type was not explicitly assigned.

Related errors


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