Roblox Studio error

MarketplaceService:GetProductInfo() X is not a valid assetId

What MarketplaceService:GetProductInfo() X is not a valid assetId means in Roblox Studio, the two things that cause it with the code that triggers each, and the fix for each one.

Updated 12 November 20263 min readErrorLuauWritten by

In short

GetProductInfo fetches the name and price of an item from Roblox. It refuses IDs that cannot exist, like 0 or a negative number, and the message shows the number it got. Usually the ID is a placeholder left at 0, or an attribute or table entry that was never filled in. Set the real ID, skip anything that is not above 0, pass Enum.InfoType.Product or Enum.InfoType.GamePass for those kinds of items, and wrap the call in pcall.

On this page
  1. What it means
  2. Causes and fixes
  3. Fix it with RoCode
  4. Find the line
  5. Questions
  6. Sources

What the message means

Output (example)
ServerScriptService.ShopPrices:9: MarketplaceService:GetProductInfo() 0 is not a valid assetId

Other forms of the same message:

  • MarketplaceService:PromptPurchase() second argument is not a valid assetId (supplied assetId was less than 0)

By default the function looks up an asset, such as a shirt or a model. Developer products and game passes need the InfoType argument, or Roblox looks in the wrong place.

It is a web request, so even with a good ID it can fail now and then. pcall keeps one failure from stopping a whole shop.

Roblox now marks GetProductInfo as deprecated and documents GetProductInfoAsync, with the same ID and InfoType arguments. The fixed code below uses it; the ID rules are the same.

Causes and fixes

Two things cause this error in practice. Each one below has the smallest code that triggers it, then the fix.

A placeholder or missing ID

A shop table has id = 0 for an item you have not created yet, or reads an attribute that is not set.

Breaks Script in ServerScriptService named ShopPrices
local MarketplaceService = game:GetService("MarketplaceService")

local items = {
    { name = "Speed Coil", id = 123456789 },
    { name = "Double Coins", id = 0 }, -- not created yet
}

for _, item in items do
    local info = MarketplaceService:GetProductInfo(item.id)
    print(item.name, info.PriceInRobux)
end

Skip IDs that are not above 0, and read each price in a pcall.

Fixed Script in ServerScriptService named ShopPrices
local MarketplaceService = game:GetService("MarketplaceService")

local items = {
    { name = "Speed Coil", id = 123456789 },
    { name = "Double Coins", id = 0 }, -- not created yet
}

for _, item in items do
    if item.id <= 0 then
        warn(item.name, "has no ID yet")
        continue
    end
    local ok, info = pcall(function()
        return MarketplaceService:GetProductInfoAsync(item.id, Enum.InfoType.GamePass)
    end)
    if ok then
        print(item.name, info.PriceInRobux)
    end
end

A developer product read as an asset

Without the InfoType argument, a developer product ID is looked up as an asset, so the result is wrong or the call fails.

Breaks Script in ServerScriptService named ProductInfo
local MarketplaceService = game:GetService("MarketplaceService")

local COINS_PRODUCT = 987654321
local info = MarketplaceService:GetProductInfo(COINS_PRODUCT)
print(info.Name)

Pass Enum.InfoType.Product for developer products and Enum.InfoType.GamePass for game passes.

Fixed Script in ServerScriptService named ProductInfo
local MarketplaceService = game:GetService("MarketplaceService")

local COINS_PRODUCT = 987654321
local ok, info = pcall(function()
    return MarketplaceService:GetProductInfoAsync(COINS_PRODUCT, Enum.InfoType.Product)
end)
if ok then
    print(info.Name, info.PriceInRobux)
end

Fix it in your place

Paste the error, RoCode fixes it in your place

Copy the line from Output and paste it here. RoCode opens the script it names in the place you have open in Studio, works out which of the causes above it is, and edits the code there instead of handing you a snippet to paste.

For example: ServerScriptService.ShopPrices:9: MarketplaceService:GetProductInfo() 0 is not a valid assetId

RoCode is an AI agent for Roblox Studio: it reads the scripts in the place you have open, finds the line and edits it there, and every change is an undo point. It runs on Windows or macOS with a desktop browser. Free to start, with free credits every day.

How to find the line that causes it

  1. Open Output (Window menu, or the Script tab), clear it with Ctrl+K (⌘K on Mac), and press Play.
  2. Find the first red line. It starts with the script's place in the Explorer and the line number, such as ServerScriptService.Shop:12:.
  3. Click the red line. Studio opens that script with the cursor on the failing line.
  4. Read the lines between Stack Begin and Stack End under it: they list the calls that led there, newest first, so you can see which function called the broken one.
  5. Still not sure which value is wrong? Add print(typeof(x), x) just above the line, or set a breakpoint on it and read the values in the Watch window.

Questions

Where do I find a game pass or developer product ID?

On the Creator Dashboard, under your experience, Monetization. Each pass and product shows its ID; copy it into your script or an attribute.

Should I read prices on the client or the server?

Either can call GetProductInfo. Read them on the client for a shop screen, but always check and grant purchases on the server.

Why does the price come back wrong for my developer product?

Without Enum.InfoType.Product, the ID is looked up as an asset, which is a different item or none at all. Pass the InfoType that matches the item.

Can RoCode fix it?

Yes. Paste the Output line into RoCode. It finds the empty or wrong IDs in your place and makes the price lookups safe.

Sources and further reading

How the code was checked: every block marked Fixed passes Luau's strict type checker against Roblox's API definitions (luau-lsp, 12 November 2026), and every block marked Breaks compiles and fails only when it runs. The message wording was checked against the message format strings in Roblox Studio itself (macOS build installed on 12 November 2026) on 12 November 2026. A type check catches misspelt APIs and wrong types, not game logic, so playtest in Studio before you publish.

More Roblox errors

All Roblox Studio errors

Stop hunting errors line by line.

RoCode reads the scripts in your open place, fixes the error where it happens and tells you what it changed. Free every day, no card required.