Skip to content

7 templates are not valid JSON and cannot be imported - trailing text after the closing brace #201

Description

@jgivati-design

Seven workflow files in this repo fail json.loads, so n8n's import rejects them. The repo advertises ready-to-use templates; these seven cannot be opened at all.

Two distinct causes, both consistent with a scrape that concatenated the workflow body with the following field without a separator.

A second JSON document appended after the first

file
AI_Research_RAG_and_Data_Analysis/Host Your Own AI Deep Research Agent with n8n, Apify and OpenAI o3.json
AI_Research_RAG_and_Data_Analysis/🔍 Perplexity Research to HTML_ AI-Powered Content Creation.json

The first document ends normally, then a second complete workflow begins: ...}}}{"meta": {"instanceId": ...

The workflow's own title appended as raw text

file trailing bytes
AI_Research_RAG_and_Data_Analysis/Recipe Recommendations with Qdrant and Mistral.json 47
Notion/Automate Competitor Research with Exa.ai, Notion and AI Agents.json 186
OpenAI_and_LLMs/AI-Driven Lead Management and Inquiry Automation with ERPNext & n8n.json 67
OpenAI_and_LLMs/lemlist __ GPT-3_ Supercharge your sales workflows.json 51
PDF_and_Document_Processing/Parse PDF with LlamaParse and save to Airtable.json 46

Example, end of lemlist __ GPT-3_ Supercharge your sales workflows.json:

..."type": "main", "index": 0 } ] ] } } }slemlist <> GPT-3: Supercharge your sales workflows

Note the stray s before the title in two of them, suggesting a truncated key name rather than a clean concatenation.

Reproduction

git clone --depth 1 https://github.com/enescingoz/awesome-n8n-templates
cd awesome-n8n-templates
python3 - <<'PY'
import json, glob, io
for f in sorted(glob.glob("**/*.json", recursive=True)):
    if ".github" in f: continue
    try:
        json.loads(io.open(f, encoding="utf8").read())
    except json.JSONDecodeError as e:
        print(f"{e.__class__.__name__}: {f}")
PY

341 of 349 files parse. The eight that do not are the seven above plus Other/ALL_unique_nodes.json, which appears not to be a workflow file and may be intentional.

Suggested fix

Truncate each file at the end of its first JSON value. json.JSONDecoder().raw_decode() returns the offset where the valid document ends, so the repair is mechanical:

import json, io
dec = json.JSONDecoder()
raw = io.open(path, encoding="utf8").read()
obj, end = dec.raw_decode(raw)
io.open(path, "w", encoding="utf8").write(json.dumps(obj, indent=2, ensure_ascii=False))

For the two files with a second document appended, decide which workflow belongs in that file first - the second document is a different workflow, not a duplicate.

Worth adding the parse check above to CI so a future scrape cannot reintroduce this.


Found while pointing an external execution-history checker at published template collections. It reads n8n's public API rather than workflow JSON, so it flagged these when import failed rather than when a run misbehaved. MIT licensed if it's useful to you: https://github.com/moneywithjjcom-del/ranfine-

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions