replicate/replicate-javascript

Error 422 - Additional property signal not allowed.

VektorTech opened this issue ยท 12 comments

Sending a request to https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct/predictions from the browser with abort signal,

await this.replicate.run(model, {
  input,
  signal: this.abortSignal,
}

results in the following error:

https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct/predictions failed with status 422 : {"detail":"- Additional property signal is not allowed\n","status":422,"title":"Input validation failed","invalid_fields":[{"type":"additional_property_not_allowed","field":"","description":"Additional property signal is not allowed"}]}

Request payload show in chrome devtools:

{
    "signal": {},
    "input": {
        "prompt": "hey",
        "prompt_template": "",
        "max_tokens": "",
        "temperature": 1,
        "presence_penalty": 0,
        "frequency_penalty": 0
    },
    "stream": true
}
mattt commented

Hi @VektorTech. Sorry, that was a bug in the client. We have a fix in #251 that landed in the latest version, v0.29.2. Please npm i replicate@latest to update to the latest and let us know if you're still seeing this error. Thanks!

Hey @mattt, I'm still getting the error with the updated version, and the signal: {} field is still being dispatched with the payload.

mattt commented

@VektorTech Hmm, this assertion should test that signal isn't sent in the request body... Can you share a minimal example that reproduces the issue with a public model?

for me, upgrading to 0.29.3 fixed this issue.

Hey @mattt, I've attached a link to a small Vite project that reproduces the issue. As you'll see, Replicate is initialized and runs from inside a service worker, as with my current setup. In this environment, the library passes the signal field to the /predictions endpoint where the error occurs.

replicate_bug-Archive.zip

mattt commented

@VektorTech Thanks so much for sharing that. I didn't realize you were calling replicate.stream. And looking at the implementation of that method, I immediately see the problem. This should be fixed by #254.

mattt commented

@VektorTech That fix is now available in v0.29.4. Please give that a try and confirm that everything's working as expected.

@mattt, v0.29.4 solves the issue, thank you.

Error generating image: ReplicateError Details: title: Invalid version or not permitted status: 422 detail: The specified version does not exist (or perhaps you don't have permission to use it?) i am getting this error from past 6 days
@mattt

S1001C commented

Error generating image: ReplicateError Details: title: Invalid version or not permitted status: 422 detail: The specified version does not exist (or perhaps you don't have permission to use it?) i am getting this error from past 6 days @mattt

me too

Same issue: "title":"Invalid version or not permitted","detail":"The specified version does not exist (or perhaps you don't have permission to use it?

Maybe you guys can provide more details in your error messages?

using this end point: "https://api.replicate.com/v1/models/black-forest-labs/flux-pro/predictions"

Same issue: "title":"Invalid version or not permitted","detail":"The specified version does not exist (or perhaps you don't have permission to use it?

Maybe you guys can provide more details in your error messages?

using this end point: "https://api.replicate.com/v1/models/black-forest-labs/flux-pro/predictions"

I got it working by entering my CC details in the billing section, and then setting a max monthly limit spend.