Skip to content

Malformed function call #9

Closed
Closed

Description

@pentium10

For some reason suddenly stops with:
Raw response:
{"candidates":[{"content":{},"finish_message":"Malformed function call: query = \"\"\"\nSELECT column_name\nFROM `wr_dataset.INFORMATION_SCHEMA.COLUMNS`\nWHERE table_name = 'order_items'\n\"\"\"\nresults = run_bigquery_query(query)\nprint(results)\n","finish_reason":"MALFORMED_FUNCTION_CALL"}],"create_time":"2025-04-09T21:36:06.627984Z","response_id":"Ruj2Z5CqJuGCqsMPxdPYoAY","model_version":"gemini-2.0-flash-exp","usage_metadata":{"prompt_token_count":4250,"prompt_tokens_details":[{"modality":"TEXT","token_count":4250}],"total_token_count":4250,"traffic_type":"ON_DEMAND"},"automatic_function_calling_history":[]}

the query is okay, but for some reason doesn't call the tool
even the log doesn't list the tool it failed

tools=[get_bigquery_table_ddl, run_bigquery_query, get_bigquery_view_ddl],

def get_bigquery_table_ddl(dataset_id: str, table_id: str) -> dict:
    """Retrieves the create table statement of a specified BigQuery table.

    Args:
        dataset_id: The ID of the BigQuery dataset.
        table_id: The ID of the BigQuery table.
        tool_context: ToolContext,

    Returns:
        A dictionary containing the DDL statement for the table, or an error message if the table is not found.  The dictionary will have a "ddl" key if successful or an "error" key if not.
    """
    try:
        from google.cloud import bigquery

        client = bigquery.Client()
        ddl_query = f"""
            SELECT ddl
            FROM `{client.project}.{dataset_id}.INFORMATION_SCHEMA.TABLES`
            WHERE table_name = '{table_id}'
        """
        print(ddl_query)

        ddl_result = client.query(ddl_query).result()
        ddl_rows = list(ddl_result)

        if ddl_rows:
            ddl = ddl_rows[0].ddl
            return {"ddl": ddl}
        else:
             return {"error": f"Table '{table_id}' not found in dataset '{dataset_id}'."}

    except Exception as e:
        return {"error": f"Error fetching table DDL: {str(e)}"}

Activity

  1. hangfei commented on Apr 9, 2025

    @hangfei
    Collaborator

    Do you have an minimal example we can use to reproduce the error? It should include the models, instruction you use etc.

  2. pentium10 commented on Apr 10, 2025

    @pentium10
    Author

    I am monitoring this issue, today it went smooth. Maybe it was something with yesterday model's shifting behind aliases.

  3. hangfei commented on Apr 11, 2025

    @hangfei
    Collaborator

    Glad it works now. Feel free to re-open if you still see the issue.

  4. aicam commented on Jun 3, 2025

    @aicam

    I have the issue, @pentium10 any symptom or solution you found?

  5. added
    web[Component] This issue will be transferred to adk-web
    on Jul 9, 2025
  6. added a commit that references this issue on Nov 14, 2025
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

    web[Component] This issue will be transferred to adk-web

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions