medusajs/medusa · error · MedusaError

Price list with id: ${id} was not found

Error message

Price list with id: ${id} was not found

What it means

Thrown by getPriceList in the price-list queries module when the remoteQuery result, after sanitization via buildPriceListResponse, is not present. Functionally the same family as the fetchPriceList variant: the requested price list id resolved to nothing.

Source

Thrown at packages/medusa/src/api/admin/price-lists/queries/get-price-list.ts:33

  apiFields,
}: {
  id: string
  container: MedusaContainer
  remoteQueryFields: string[]
  apiFields: string[]
}): Promise<AdminPriceListRemoteQueryDTO> {
  const remoteQuery = container.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
  const queryObject = remoteQueryObjectFromString({
    entryPoint: "price_list",
    fields: remoteQueryFields,
    variables: { id },
  })

  const priceLists = await remoteQuery(queryObject)
  const [sanitizedPriceList] = buildPriceListResponse(priceLists, apiFields)

  if (!isPresent(sanitizedPriceList)) {
    throw new MedusaError(
      MedusaError.Types.NOT_FOUND,
      `Price list with id: ${id} was not found`
    )
  }

  return sanitizedPriceList
}

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. List price lists (GET /admin/price-lists) to confirm the id
  2. Re-seed or recreate the price list if the database was reset
  3. Cross-check environment ids in custom integrations before calling

Example fix

// before
const { price_list } = await sdk.admin.priceList.retrieve(plId)

// after
const { price_lists } = await sdk.admin.priceList.list()
const pl = price_lists.find((p) => p.id === plId)
if (!pl) throw new Error(`Price list ${plId} missing; recreate before use`)
Defensive patterns

Strategy: try-catch

Validate before calling

const { price_lists } = await sdk.admin.priceList.list({ id: [plId] })
if (price_lists.length === 0) throw new Error(`Price list ${plId} not found`)

Type guard

const isPriceList = (v: unknown): v is HttpTypes.AdminPriceList =>
  !!v && typeof v === "object" && "id" in v

Try / catch

try {
  return await getPriceList(id)
} catch (e: any) {
  if (e.statusCode === 404) return undefined
  throw e
}

Prevention

When it happens

Trigger: Querying a price list id that does not exist, was soft-deleted, or whose record was filtered out by the query constraints.

Common situations: Stale id references after re-seeding a dev database, concurrent deletion by another admin, or passing an internal id from a webhook payload for a different store/environment.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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