#4155·altair

在某些联合和通道中,错误消息指定了错误的类或参数

作者: mattijn创建于 2026年9月28日更新于 2026年9月28日
cmd
SchemaValidationError: `YDatum` has no parameter named 'field'

Existing parameter names are:
datum          impute   title
axis           scale    type
bandPosition

See the help for `YDatum` to read the full description of these parameters

YDatum does not have a parameter named field, so the sentence reads as wrong. Y would fit better here. The "belongs to" lines also use the schema names. The user knows these as YDatum and YValue, not PositionDatumDef and PositionValueDef.

5. A tooltip in a list is named after the schema, not after the class the user wrote.

zzterm5zz
alt.Chart("d.csv").mark_point().encode(tooltip=[alt.Tooltip("a:N", bogus=1)]).to_dict()
cmd
SchemaValidationError: `StringFieldDef` has no parameter named 'bogus'

Existing parameter names are:
aggregate      field        timeUnit
bandPosition   format       title
bin            formatType   type

See the help for `StringFieldDef` to read the full description of these parameters

The user wrote alt.Tooltip, not StringFieldDef. Without the list it says Tooltip:

zzterm6zz
alt.Chart("d.csv").mark_point().encode(tooltip=alt.Tooltip("a:N", bogus=1)).to_dict()
cmd
SchemaValidationError: `Tooltip` has no parameter named 'bogus'

Existing parameter names are:
shorthand      bin         format       title
aggregate      condition   formatType   type
bandPosition   field       timeUnit

The table under StringFieldDef is the more precise one: an item in a tooltip list has no condition. So ideally the message says Tooltip and shows the names that are valid for an item in the list.