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 the fetchPriceList helper when a remoteQuery for the price list id returns no present record. It is used by price-list routes to refetch after mutations; a missing/soft-deleted price list produces this NOT_FOUND error.
Source
Thrown at packages/medusa/src/api/admin/price-lists/helpers.ts:29
export const fetchPriceList = async (
id: string,
scope: MedusaContainer,
fields: string[]
) => {
const remoteQuery = scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
const queryObject = remoteQueryObjectFromString({
entryPoint: "price_lists",
variables: {
filters: { id },
},
fields,
})
const [priceList] = await remoteQuery(queryObject)
if (!isPresent(priceList)) {
throw new MedusaError(
MedusaError.Types.NOT_FOUND,
`Price list with id: ${id} was not found`
)
}
return transformPriceList(priceList)
}
export const transformPriceList = (priceList) => {
priceList.rules = buildPriceListRules(priceList.price_list_rules)
priceList.prices = buildPriceSetPricesForCore(priceList.prices)
delete priceList.price_list_rules
return priceList
}
export const fetchPriceListPriceIdsForProduct = async (View on GitHub (pinned to 5e06e544a2)
Solutions
- Confirm the price list exists with GET /admin/price-lists/:id and handle the 404 gracefully
- If it was deleted, recreate it or stop referencing it
- Audit custom code for hardcoded price list ids after data resets/seeding
Example fix
// before
await sdk.admin.priceList.update(plId, { prices })
// after
try {
await sdk.admin.priceList.update(plId, { prices })
} catch (e) {
if (e.statusCode === 404) return // price list gone; nothing to update
throw e
} Defensive patterns
Strategy: try-catch
Validate before calling
const { price_lists } = await sdk.admin.priceList.list()
if (!price_lists.some((p) => p.id === plId)) throw new Error(`Missing price list ${plId}`) Type guard
const isPriceList = (v: unknown): v is HttpTypes.AdminPriceList => !!v && typeof v === "object" && "id" in v && "prices" in v
Try / catch
try {
return await updatePriceList(id, patch)
} catch (e: any) {
if (e.statusCode === 404) return null // already deleted
throw e
} Prevention
- Handle 404 as a no-op for post-deletion refetches in sync jobs
- Re-seed and re-map ids after db resets
- Avoid hardcoded price list ids
When it happens
Trigger: Any admin price-list route that refetches after update/delete (or GET via this helper) with an id that does not exist or was deleted.
Common situations: Continuing to operate on a price list deleted in another tab or by another admin, expired price lists being cleaned up, or a typo'd id in custom scripts.
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
- Invite with id: ${id} was not found
- No product ids passed to remove from price list
- Price list with id: ${id} was not found
- Product category with id: ${req.params.id} was not found
- Product option value with id "${valueId}" was not found for
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/d4e30d6c47408521.
Report an issue: GitHub.