AGNO JSONKnowledgeBase Load Fails with ‘Unsupported data type’ on Top-Level JSON Array

Hello Support Team,

I’m trying to load a JSON knowledge base into PgVector and keep running into an “Unsupported data type” error. Below is a minimal reproducible example of my setup:

from pathlib import Path
from agno.agent import Agent
from agno.knowledge.json import JSONKnowledgeBase, JSONReader
from agno.vectordb.pgvector import PgVector, SearchType
from agno.models.azure import AzureOpenAI
from agno.embedder.azure_openai import AzureOpenAIEmbedder

DATABASE_URL = "{my_database_url}"

agent_description = "You are an agent for searching the Concept table."

knowledge_base = JSONKnowledgeBase(
    path="vocabulary_download_v5/output_only100.json",
    reader=JSONReader(),
    vector_db=PgVector(
        table_name="json_concept",
        db_url=DATABASE_URL,
        search_type=SearchType.vector,
        embedder=AzureOpenAIEmbedder(),
    ),
)

agent = Agent(
    name="concept_agent",
    model=AzureOpenAI(id="gpt-4o"),
    description=agent_description,
    knowledge=knowledge_base,
    tools=[],
    show_tool_calls=True,
    markdown=True
)

if agent.knowledge is not None:
    agent.knowledge.load(recreate=False)

When I run this, I immediately get:

(base) snomed % python3 scripts/main.py

INFO Loading knowledge base                                                     
INFO Reading: vocabulary_download_v5/output_only100.json                        
ERROR    Error processing document 'output_only100': Unsupported data type      
/Users/kensukemiyake/.pyenv/versions/3.10.11/lib/python3.10/site-packages/agno/vectordb/pgvector/pgvector.py:339: SAWarning: Column 'ai.json_concept.id' is marked as a member of the primary key for table 'ai.json_concept', but has no Python-side or server-side default generator indicated, nor does it indicate 'autoincrement=True' or 'nullable=True', and no explicit value is passed.  Primary key columns typically may not store NULL.
  sess.execute(insert_stmt, batch_records)
INFO Inserted batch of 0 documents.                                             
ERROR    Error processing document 'output_only100': Unsupported data type 

For reference, here is a small excerpt from output_only100.json:

[
  {
    "name": "003630641",
    "content": "hemorrhoidal cream 10mg/g / 144mg/g … TOPICAL CREAM",
    "meta_data": {
      "vocabulary_id": "NDC",
      "concept_class_id": "9-digit NDC"
    }
  },
  {
    "name": "167290436",
    "content": "fulvestrant 250mg/5mL INTRAMUSCULAR INJECTION",
    "meta_data": {
      "vocabulary_id": "NDC",
      "concept_class_id": "9-digit NDC"
    }
  }
  // …more entries…
]
  1. Why does AGNO report “Unsupported data type” on what appears to be plain JSON objects?
  2. Is there a specific file format or reader configuration I need to change (e.g. NDJSON vs. array)?
  3. Do I need to adjust any JSONReader or JSONKnowledgeBase parameters to accept a top-level array?

Any guidance on how to proceed would be much appreciated!

Thank you in advance,
Kensuke Miyake

@Monali

This is an urgent matter and would need a support as soon as possible. Thank you so much in advance,

Allow me to re-share the error that I’m getting. Please support me for following error:

INFO Reading: /Users/kensukemiyake/yuiquery/vocabulary_download_v5/output_100.json                                        
ERROR    Error processing document 'output_100': Unsupported data type                                                    
/Users/kensukemiyake/.pyenv/versions/3.10.11/lib/python3.10/site-packages/agno/vectordb/pgvector/pgvector.py:339: SAWarning: Column 'ai.json_concept.id' is marked as a member of the primary key for table 'ai.json_concept', but has no Python-side or server-side default generator indicated, nor does it indicate 'autoincrement=True' or 'nullable=True', and no explicit value is passed.  Primary key columns typically may not store NULL.
  sess.execute(insert_stmt, batch_records)
ERROR    Error with batch starting at index 0: (psycopg.errors.NotNullViolation) null value in column "id" of relation    
         "json_concept" violates not-null constraint                                                                      
         DETAIL:  Failing row contains (null, null, {}, {}, null, null, null, 2025-06-09 12:01:30.044604+09, null, null). 
         [SQL: INSERT INTO ai.json_concept DEFAULT VALUES]                                                                
         (Background on this error at: https://sqlalche.me/e/20/gkpj)                                                     
ERROR    Error inserting documents: (psycopg.errors.NotNullViolation) null value in column "id" of relation "json_concept"
         violates not-null constraint                                                                                     
         DETAIL:  Failing row contains (null, null, {}, {}, null, null, null, 2025-06-09 12:01:30.044604+09, null, null). 
         [SQL: INSERT INTO ai.json_concept DEFAULT VALUES]                                                                
         (Background on this error at: https://sqlalche.me/e/20/gkpj)                                                     
Traceback (most recent call last):
  File "/Users/kensukemiyake/.pyenv/versions/3.10.11/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
  File "/Users/kensukemiyake/.pyenv/versions/3.10.11/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 924, in do_execute
    cursor.execute(statement, parameters)
  File "/Users/kensukemiyake/.pyenv/versions/3.10.11/lib/python3.10/site-packages/psycopg/cursor.py", line 732, in execute
    raise ex.with_traceback(None)
psycopg.errors.NotNullViolation: null value in column "id" of relation "json_concept" violates not-null constraint
DETAIL:  Failing row contains (null, null, {}, {}, null, null, null, 2025-06-09 12:01:30.044604+09, null, null).

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/kensukemiyake/yuiquery/scripts/main.py", line 42, in <module>
    agent.knowledge.load(recreate=True)
  File "/Users/kensukemiyake/.pyenv/versions/3.10.11/lib/python3.10/site-packages/agno/knowledge/agent.py", line 137, in load
    self.vector_db.insert(documents=[doc], filters=doc.meta_data)
  File "/Users/kensukemiyake/.pyenv/versions/3.10.11/lib/python3.10/site-packages/agno/vectordb/pgvector/pgvector.py", line 339, in insert
    sess.execute(insert_stmt, batch_records)
  File "/Users/kensukemiyake/.pyenv/versions/3.10.11/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2351, in execute
    return self._execute_internal(
  File "/Users/kensukemiyake/.pyenv/versions/3.10.11/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2245, in _execute_internal
    result = conn.execute(
  File "/Users/kensukemiyake/.pyenv/versions/3.10.11/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1418, in execute
    return meth(
  File "/Users/kensukemiyake/.pyenv/versions/3.10.11/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection
    return connection._execute_clauseelement(
  File "/Users/kensukemiyake/.pyenv/versions/3.10.11/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement
    ret = self._execute_context(
  File "/Users/kensukemiyake/.pyenv/versions/3.10.11/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
    return self._exec_single_context(
  File "/Users/kensukemiyake/.pyenv/versions/3.10.11/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
    self._handle_dbapi_exception(
  File "/Users/kensukemiyake/.pyenv/versions/3.10.11/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2353, in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "/Users/kensukemiyake/.pyenv/versions/3.10.11/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
  File "/Users/kensukemiyake/.pyenv/versions/3.10.11/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 924, in do_execute
    cursor.execute(statement, parameters)
  File "/Users/kensukemiyake/.pyenv/versions/3.10.11/lib/python3.10/site-packages/psycopg/cursor.py", line 732, in execute
    raise ex.with_traceback(None)
sqlalchemy.exc.IntegrityError: (psycopg.errors.NotNullViolation) null value in column "id" of relation "json_concept" violates not-null constraint
DETAIL:  Failing row contains (null, null, {}, {}, null, null, null, 2025-06-09 12:01:30.044604+09, null, null).
[SQL: INSERT INTO ai.json_concept DEFAULT VALUES]
(Background on this error at: https://sqlalche.me/e/20/gkpj)

Hey @Kenniferm
thanks for reaching out and supporting Agno. I’ve shared this with the team and we will get back to asap.

Thanks. Also, below is my current json file that I am trying to load:

[
{
“id”: “36189414”,
“name”: “003630641”,
“content”: “hemorrhoidal cream 10mg/g / 144mg/g / 150mg/g / 2.5mg/g TOPICAL CREAM”
},
{
“id”: “1220863”,
“name”: “167290436”,
“content”: “fulvestrant 250mg/5mL INTRAMUSCULAR INJECTION”
},
{
“id”: “3541502”,
“name”: “694331000000106”,
“content”: “Adverse reaction to drug primarily affecting the autonomic nervous system NOS”
},
{
“id”: “3542356”,
“name”: “705311000000105”,
“content”: “Adverse reaction to other central nervous system depressants and anaesthetics”
},
{
“id”: “42538812”,
“name”: “762620006”,
“content”: “Somatic hallucination”
},

… continues