Polkadot Asset Hub: "/runtime/metadata" Error 500
If you’re getting a 500 error when calling the /substrateapi/runtime/metadata
endpoint on Polkadot Asset Hub, it’s caused by a known compatibility issue in the Substrate API Sidecar.
Example response:
{"code":500,"message":"createType(PalletUtilityCall):: Unable to create Enum via index 80, in batch, as_derivative, batch_all, dispatch_as, force_batch, with_weight, if_else, dispatch_as_fallible","stack":"Error: createType(PalletUtilityCall):: Unable to create Enum via index 80, in batch, as_derivative, batch_all, dispatch_as, force_batch, with_weight, if_else, dispatch_as_fallible\n at createTypeUnsafe (/usr/local/lib/node_modules/@substrate/api-sidecar/node_modules/@polkadot/types-create/cjs/create/type.js:54:22)\n at TypeRegistry.createType (/usr/local/lib/node_modules/@substrate/api-sidecar/node_modules/@polkadot/types/cjs/create/registry.js:224:52)\n at sanitizeMetadataExceptionsV14 ...
Cause
A recent runtime upgrade on Polkadot introduced changes that are not yet compatible with the current Substrate API Sidecar version. Because of this, requests made to: /substrateapi/runtime/metadata
fail when no specific metadata version is set.
Solution
Specify the metadata version directly in the endpoint. Either of the following versions should work:
/substrateapi/runtime/metadata/v15
/substrateapi/runtime/metadata/v16
Example request:
curl --location 'https://polkadot-assethub.gateway.tatum.io/substrateapi/runtime/metadata/v15' \
--header 'x-api-key: {YOUR_API_KEY}'
This will return the metadata successfully.
Note
For additional context and ongoing updates, see the related GitHub issues:
Updated about 3 hours ago