Skip to content

ValidationError: Unprocessable Entity #145

Description

@Craigson

Issue

Subscribing to certain models throws an Unprocessable Entity error with no more information or context.

Model

fal-ai/kling-video/v1.6/pro/text-to-video

Dependencies

"typescript": "^5",
"@fal-ai/client": "^1.5.0",

Reproduction

This is the input passed to the model:

{
              "cfg_scale": 0.5,
              "duration": "5",
              "negative_prompt": "blur, distort, and low quality",
              "prompt": "A medieval knight pulling a magic sword from a stone",
              "aspect_ratio": "16:9"
}

Using the example same input via the Fal playground UI does not throw the error.

import { fal } from "@fal-ai/client";

export class FalModelCaller implements BaseModelCaller {
  private fal: typeof fal;

  constructor(apiKey: string) {
    this.fal = fal;
    this.fal.config({
      credentials: apiKey,
    });
  }

  // other methods ommited for brevity

  async callModel(params: {
    modelName: string;
    useCase: ModelUseCase;
    input: Record<string, any>;
    logs?: boolean;
    onUpdate?: (update: any) => void;
  }): Promise<AssetResult[]> {
    const { modelName, input, logs = true, onUpdate } = params;
    const pollInterval =
      params.useCase === MODEL_USE_CASES.IMAGE_GENERATION ? 500 : 2500;

    try {

      const result = await this.fal.subscribe(modelName, {
        input,
        logs,
        mode: "polling",
        pollInterval,
        onQueueUpdate: (update) => {
          switch (update.status) {
            case "IN_QUEUE":
              console.log("Queued");
              break;
            case "IN_PROGRESS":
              console.log("in progress");
              onUpdate?.(update);
              if (update.logs) {
                update.logs.map((log) => log.message).forEach(console.log);
              }
              break;
            case "COMPLETED":
              console.log("completed fal model execution");
              break;
          }
        },
      });

      // NOTE: <==== Error is thrown before reaching this point

      const responseAdapter = this.getResponseAdapter(params.useCase);
      const processedResult = responseAdapter.transform(result.data);
      return processedResult;
    } catch (error) {
      console.error("Error calling FAL model:", error);
      throw error;
    }
}

Error

This is the error thrown by the Fal client:

    {
      "message": [
        "Error calling FAL model:",
        "ValidationError: Unprocessable Entity"
      ],
      "level": "error",
      "timestamp": 1753117956817
    },

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    follow-upIssues that are awaiting either a OP response or requires someone from fal to follow upquestionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions