medusajs/medusa · error · MedusaError

Currency with code: ${req.params.code} was not found

Error message

Currency with code: ${req.params.code} was not found

What it means

The GET /admin/currencies/:code route runs a remote query against the currency entity (from the region/currency data seeded by the currency module); an unknown code throws NOT_FOUND (HTTP 404).

Source

Thrown at packages/medusa/src/api/admin/currencies/[code]/route.ts:25

import { HttpTypes } from "@medusajs/framework/types"

export const GET = async (
  req: MedusaRequest<HttpTypes.AdminCurrencyParams>,
  res: MedusaResponse<HttpTypes.AdminCurrencyResponse>
) => {
  const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)

  const variables = { filters: { code: req.params.code } }

  const queryObject = remoteQueryObjectFromString({
    entryPoint: "currency",
    variables,
    fields: req.queryConfig.fields,
  })

  const [currency] = await remoteQuery(queryObject)
  if (!currency) {
    throw new MedusaError(
      MedusaError.Types.NOT_FOUND,
      `Currency with code: ${req.params.code} was not found`
    )
  }

  res.status(200).json({ currency })
}

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Use valid ISO 4217 codes (e.g. usd, eur) exactly as returned by GET /admin/currencies
  2. Ensure the currency is enabled/installed in the store before querying it
  3. List currencies first and derive the code from the response
Defensive patterns

Strategy: type-guard

Validate before calling

const { currencies } = await sdk.currency.list()
const codeOk = currencies.some((c) => c.code === code.toLowerCase())
if (!codeOk) throw new Error(`Unsupported currency code: ${code}`)

Type guard

const isValidISOCurrency = (code: string): boolean =>
  /^[a-z]{3}$/.test(code) && SUPPORTED_CODES.has(code)

Try / catch

try { await getCurrency(code) } catch (e) { if (e.statusCode === 404) showCurrencyPicker() else throw e }

Prevention

When it happens

Trigger: GET /admin/currencies/usdX (invalid/mistyped code); querying a currency not installed in the store's currency settings.

Common situations: Passing lowercase vs uppercase mismatch expectations, full currency names instead of ISO 4217 codes, or codes for currencies never enabled in the store.

Related errors


AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27). Data as JSON: /api/errors/b87ebd21f54bdc53. Report an issue: GitHub.