When building the Smart Content Dispatcher in n8n, the initial prototype worked nicely on manual single executions. But the moment I deployed the schedule trigger to autonomously research, generate, format, and publish multi-media posts directly to LinkedIn every 48 hours, production reality hit hard.
The first major blocker was LLM output instability. Even when prompting Google Gemini with strict response schemas, the model would intermittently wrap its JSON in markdown backticks (```json ... ```) or append conversational preamble. When passed directly to downstream LinkedIn API nodes, the JSON parser would throw an unhandled exception, abruptly halting the workflow.
To solve this, I wrote a dedicated JavaScript code node that parses the incoming AST stream, strips stray markdown code blocks, normalizes newlines, and executes a humanizing pass to strip AI boilerplate phrasing before validating the final payload against an explicit schema.
The second blocker was binary media handling. Retrieving high-res photography via the Unsplash API and piping binary streams across multiple n8n nodes frequently bloated container memory on Render. I refactored the pipeline to pass temporary asset buffers with direct garbage collection immediately after the LinkedIn OAuth2 image upload handshake.
By implementing automated retries on Tavily search timeouts and isolating text formatting in pure JavaScript, the workflow has been running autonomously in production with a 100% execution success rate.