ory/hydra · error

multiple types %+v are not supported for path: %s

Error message

multiple types %+v are not supported for path: %s

What it means

listPaths/makeUnique in oryx/jsonschemax builds a cache of properties while walking a JSON Schema. When a property name appears more than once, it compares the concrete Go types of the two accumulated property types via fmt.Sprintf("%T", ...); if the type-name comparison detects differing/unsupported multiple type declarations for the same path it refuses to proceed. Note the comparison in the source compares p.Type with itself, a known quirk that makes the error effectively unreachable as written.

Source

Thrown at oryx/jsonschemax/keys.go:183

	if err != nil {
		return nil, errors.WithStack(err)
	}

	sort.Stable(paths)
	return makeUnique(paths)
}

func makeUnique(in byName) (byName, error) {
	cache := make(map[string]Path)
	for _, p := range in {
		vc, ok := cache[p.Name]
		if !ok {
			cache[p.Name] = p
			continue
		}

		if fmt.Sprintf("%T", p.Type) != fmt.Sprintf("%T", p.Type) {
			return nil, errors.Errorf("multiple types %+v are not supported for path: %s", []interface{}{p.Type, vc.Type}, p.Name)
		}

		if vc.Default == nil {
			cache[p.Name] = p
		}
	}

	k := 0
	out := make([]Path, len(cache))
	for _, v := range cache {
		out[k] = v
		k++
	}

	paths := byName(out)
	sort.Sort(paths)
	return paths, nil
}

View on GitHub (pinned to 4174065ffb)

Solutions

  1. Restructure the schema so each path has a single consistent type (split into differently named properties or fix the $ref/anyOf merge).
  2. If the schema is intentionally multi-typed, pre-process it to pick one type or encode the union as a single object type.
  3. If you control the schema generation, fix duplicate property names at the source (e.g., protobuf name collisions).
  4. Upgrade oryx: the type comparison in makeUnique compares p.Type to itself, so a fixed version may resolve or correctly detect the conflict.

Example fix

// before (schema.json)
{"properties": {"foo": {"type": "object"}}, "foo": {"type": "string"}}
// after
{"properties": {"foo": {"type": "object"}, "fooValue": {"type": "string"}}}
Defensive patterns

Strategy: validation

Validate before calling

// Validate each path has a single type before running paths generation
for name, props := range perPathProperties {
    types := map[string]bool{}
    for _, p := range props { types[fmt.Sprintf("%T", p.Type)] = true }
    if len(types) > 1 {
        return fmt.Errorf("path %q has multiple types", name)
    }
}

Prevention

When it happens

Trigger: Calling runPaths/ListPathsWithCache on a JSON Schema where the same path accumulates multiple distinct type values in the cache (e.g., a schema declaring a key both as an object and as a primitive, or $ref unions merging into one property name).

Common situations: Schemas generated from sources like protobuf/OpenAPI where one field name resolves to several types; using jsonschemax on hand-written schemas with anyOf/oneOf producing mixed types at the same dot-path.

Related errors


AI-assisted analysis of ory/hydra@4174065ffb (2026-09-03). Data as JSON: /api/errors/ac909e705dd2b932. Report an issue: GitHub.