istio/istio · error
plugin type %v not a string
Error message
plugin type %v not a string
What it means
While indexing each plugin in the Istio CNI conflist by its 'type' field, istio-cni found a plugin whose 'type' is not a JSON string (null, number, boolean, or missing). The '%v' prints the offending value. This is a strict schema check: every CNI plugin entry must have a string 'type'.
Source
Thrown at cni/pkg/install/install.go:365
if err != nil {
return err
}
plugins, err := util.GetPlugins(cniConfigMap)
if err != nil {
return fmt.Errorf("%s: %w", cniConfigFilepath, err)
}
// Create a map to index plugins by their "type" field
pluginMap := make(map[string]map[string]any)
for _, rawPlugin := range plugins {
plugin, err := util.GetPlugin(rawPlugin)
if err != nil {
return fmt.Errorf("%s: %w", cniConfigFilepath, err)
}
if pluginType, ok := plugin["type"].(string); ok {
pluginMap[pluginType] = plugin
} else {
return fmt.Errorf("plugin type %v not a string", plugin["type"])
}
}
// Verify that the Istio CNI config exists in the CNI config plugin map
if _, exists := pluginMap["istio-cni"]; !exists {
return fmt.Errorf("istio-cni plugin not found in Istio CNI config at %s", cniConfigFilepath)
}
if useIstioOwnedCNIConfig(cfg) {
// Verifies the Istio CNI config contains all non istio-cni plugins from the primary CNI config
// and checks that the plugins are equivalent
primaryCNIConfigFilepath, err := getCNIConfigFilepath(ctx, cfg.CNIConfName, cfg.MountedCNINetDir, cfg.ChainedCNIPlugin)
if err != nil {
return err
}
primaryCniConfigMap, err := util.ReadCNIConfigMap(primaryCNIConfigFilepath)
if err != nil {
return errView on GitHub (pinned to 8dc789c5cf)
Solutions
- Open the file named in the preceding context and find the plugin entry whose 'type' is wrong: jq '.plugins[] | select((.type|type) != "string")' <file>.
- Set a proper string type (e.g. "istio-cni", "portmap", "calico") or remove the invalid entry.
- Restart istio-cni-node to re-verify, or delete the file to let it be regenerated.
Example fix
// before:
{ "name": "bad", "type": null }
// after:
{ "name": "portmap", "type": "portmap", "capabilities": {"portMappings": true} } Defensive patterns
Strategy: type-guard
Validate before calling
jq -e '.plugins | all(.[]; (.type | type) == "string")' /host/etc/cni/net.d/istio-cni-conflist
Type guard
func pluginTypeIsString(p map[string]any) (string, bool) {
t, ok := p["type"].(string)
return t, ok && t != ""
} Prevention
- Always include a string 'type' in every plugin stanza when authoring conflists.
- Lint generated CNI JSON in CI with a schema check.
- Regenerate configs from the source CNI rather than patching them by hand.
When it happens
Trigger: A plugin entry in the 'plugins' array of the Istio-owned conflist lacks 'type' or has a non-string value, hit during the per-plugin loop in checkCNIConfig after util.GetPlugin succeeds.
Common situations: Hand-edited or templated conflist with a typo (e.g. type: 032 or a commented-out field parsed wrong); a CNI chaining tool injecting a malformed plugin stanza; YAML-to-JSON conversion mistakes when users author the file from a ConfigMap.
Related errors
- %s: %w
- istio-cni plugin not found in Istio CNI config at %s
- istio-cni CNI config file modified: %s
- no valid networks found in %s
- existing CNI config: %v
AI-assisted analysis of istio/istio@8dc789c5cf (2026-08-15).
Data as JSON: /api/errors/7a585793317d78ef.
Report an issue: GitHub.