Invalid schema error when trying to reference enum in another schema

I have created two schemas, one is just an enum that I want to reuse in different schemas, I call it ServiceEnum:

{
  "name": "ServiceEnum",
  "symbols": [
    "subscription",
    "onChainEvents",
    "storage",
    "frontend",
    "database",
    "cloudCode",
    "network",
    "internal",
    "api",
    "nodes"
  ],
  "type": "enum"
}

Then I created the second schema that references the enum in it:

{
  "fields": [
    {
      "name": "orgId",
      "type": "int"
    },
    {
      "name": "service",
      "type": "ServiceEnum"
    }
  ],
  "name": "UsageBlock",
  "namespace": "Usage",
  "type": "record"
}

I was able to create both schemas and the validation passes. I have referenced the enum in the second schema:

However when trying to produce messages with said schema, confluent cli throws an invalid schema error:

% ./confluent kafka topic produce usage-create --value-format avro --schema ./schemas/schema-usage-create-value-v1.avsc
Error: {"error_code":42201,"message":"Invalid schema {\n  \"fields\": [\n    {\n      \"name\": \"orgId\",\n      \"type\": \"int\"\n    },\n    {\n      \"name\": \"service\",\n      \"type\": \"ServiceEnum\"\n    }\n  ],\n  \"name\": \"UsageBlock\",\n  \"namespace\": \"Usage\",\n  \"type\": \"record\"\n} with refs [] of type AVRO, details: \"ServiceEnum\" is not a defined name. The type of the \"service\" field must be a defined name or a {\"type\": ...} expression."}

Try passing the schema ID using --schema-id 123 instead of using --schema.

You are halfway there. Try

you need to specify the Reference name AND the type within it. Imagine you can have more than one enum in the “external” Schema reference…