Error on "Extraction Information" node

Dear,

I implement this workflow, i get this error on a loop sometimes on “Information Extractor” node with gemma2-9b-it:

Input:

[
{
“response”: “Shaken, not stirred! :cocktail_glass: James Bond à votre service. \n\nJe ne sais pas \nisdataavailableonvectordb=false\nVectorStore=true \nLM=false \nWEB=false \n\n\n”
}
]

Output:

Failed to parse. Text: "json {"isdataavailableonvectordb": false, "output": null} “. Error: SyntaxError: Unexpected token ‘`’, “```json {””… is not valid JSON Troubleshooting URL: OUTPUT_PARSING_FAILURE | 🦜️🔗 Langchain

and this error with qwen/qwen3-32b:

input:

[
{
“output”: “\nOkay, the user is asking about specific pathologies that are excluded. Let me check if this is related to insurance or contracts. The question is about exclusions in a contract, probably an insurance policy. So, isrelatedwithdomain should be true. Now, I need to respond in the James Bond style, dynamic and with emojis. Make sure to mention that I’m here to help and ask for the document. Keep it friendly and professional.\n\n\nJames Bond :sunglasses: here, your insurance & contract expert! :briefcase::sparkles:\n\nisrelatedwithdomain=true \nYour question is directly linked to insurance exclusions or contract limitations. :prohibited::magnifying_glass_tilted_left:\n\nTo provide a precise answer, I’ll need access to the specific document (e.g., policy or contract) you’re referring to. :magnifying_glass_tilted_left::page_facing_up: \nFire, flood, or pre-existing conditions excluded? Let me decode it for you! :fire::droplet::old_man: \nShare the file, and I’ll go 007 to crack the details! :hammer_and_wrench::collision:
}
]

Failed to parse. Text: " Okay, let me try again. The user asked if the question about excluded pathologies in a contract is related to the domain. The domain here is probably insurance or legal contracts. Pathologies being excluded would be part of the terms in such contracts, so it’s definitely related. The JSON schema needs a boolean under “isrelatedwithdomain”. I need to make sure the output is just the JSON with that key and no extra fields. Let me check the example they gave. They said the correct format is like {“foo”: [“bar”, “baz”]} for their example schema. So in this case, the key is “isrelatedwithdomain” and the value is true. I need to enclose it in a JSON object without any markdown. Let me make sure there are no trailing commas or extra properties. Just the one key-value pair. Alright, that should do it. {“isrelatedwithdomain”:true}“. Error: SyntaxError: Unexpected token ‘<’, " Ok”… is not valid JSON Troubleshooting URL: OUTPUT_PARSING_FAILURE | 🦜️🔗 Langchain

I have not this problem with other models as llama3-70b-8192, deepseek-r1-distill-llama-70b …

Where is the problem please?

 {
  "nodes": [
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $('Edit Fields').item.json.question }}",
        "options": {
          "systemPromptTemplate": "Tu es \"James Bond\" l'assistant expert, un assistant qui doit répondre aux questions des utilisateurs à l'aide de la base de données vectorielle.\n\nA chaque fois que tu reçois un message, présente toi en tant que \"James Bond\", ajoute des émojis, aie un ton vraiment dynamique. La réponse doit être issue uniquement des données de la base vectorielle en faisant appel aux outils. Si tu ne connais pas la réponse, répond lui \"Je ne sais pas\" et met la variable isdataavailableonvectordb=false sinon met la variable isdataavailableonvectordb=true. De plus, indique: VectorStore=true LLM=false WEB=false.\nSupprime dans la réponse les markdowns/tags comme par exemple <think> </think>.\n\nPour chaque réponse, indique la source de la réponse de cette manière: SOURCE:\n\n\n### Outils\nPVS2: fournit les éléments de réponse aux questions contenus dans la base de données vectorielle\n\n----------------\nContext: {context}"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.chainRetrievalQa",
      "typeVersion": 1.5,
      "position": [
        1680,
        1540
      ],
      "id": "4387a09a-7b0b-49e7-9ed8-eca7171154f2",
      "name": "Question and Answer Chain1",
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "text": "={{ $json.response }}",
        "schemaType": "fromJson",
        "jsonSchemaExample": "{\n\t\"isdataavailableonvectordb\": true,\n    \"output\": \"output\"\n  \n}",
        "options": {
          "systemPromptTemplate": "Extrait uniquement la valeur de la variable isdataavailableonvectordb"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "typeVersion": 1,
      "position": [
        2020,
        1540
      ],
      "id": "e4ff4ad5-a7f0-462a-9d0a-f5ada0f90bca",
      "name": "Information Extractor",
      "alwaysOutputData": false
    }
  ],
  "connections": {
    "Question and Answer Chain1": {
      "main": [
        [
          {
            "node": "Information Extractor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "54c34153644f41955df1b045b27e23c5aa493246a7d7e5e8ad537b7abbcf8133"
  }
}
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • **n8n version:1.101.1
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):Docker
  • **Operating system:Win 10

Hey @jamal hope all is well.

based on this ouput, it is likely the response comes with a language tag. Do you see that json in front of the actual json definition, it is likely the model is adding this tag. You can ask specifically not to do it in your prompt.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.