Workflow thinks node has Pinned Data

I am running N8N 1.91.2 locally and have come unstuck with a strange error in N8N.

I have a code node that takes an Outlook Calendar’s output from the Microsoft Graph, and corrects the date and time to my local time (New Zealand) before supplying the data to an A.I Agent node.

Here is the code: ```// Get all input data without using potentially problematic terminology
const allInputData = $input.all();
let eventCollection = ;

// Extract events using alternative naming
if (allInputData.length > 0) {
const firstEntry = allInputData[0].json;

// Determine data structure using alternative naming
if (Array.isArray(firstEntry)) {
eventCollection = firstEntry;
} else if (firstEntry.value && Array.isArray(firstEntry.value)) {
eventCollection = firstEntry.value;
} else if (firstEntry.output) {
// Already processed
return [{ json: { output: firstEntry.output } }];
} else {
// Use index-based access instead of map with problematic naming
eventCollection = ;
for (let idx = 0; idx < allInputData.length; idx++) {
eventCollection.push(allInputData[idx].json);
}
}

// Date/time formatting logic
const formatter = new Intl.DateTimeFormat(‘en-CA’, {
timeZone: ‘Pacific/Auckland’,
year: ‘numeric’,
month: ‘2-digit’,
day: ‘2-digit’,
hour: ‘2-digit’,
minute: ‘2-digit’,
hour12: false,
});

function toNZ(dtStr) {
const d = new Date(dtStr);
const parts = formatter.format(d).split(', ');
return ${parts[0]} ${parts[1]};
}

// Process events using index-based iteration instead of map
const resultLines = ;
for (let idx = 0; idx < eventCollection.length; idx++) {
const currentEvent = eventCollection[idx];
if (!currentEvent.start || !currentEvent.end) {
resultLines.push(Meeting ${idx+1}: Invalid data format);
continue;
}
const start = toNZ(currentEvent.start.dateTime);
const end = toNZ(currentEvent.end.dateTime);
resultLines.push(Meeting ${idx+1}: ${start}–${end});
}

// Filter out invalid entries without using problematic naming
const validLines = ;
for (let idx = 0; idx < resultLines.length; idx++) {
if (!resultLines[idx].includes(“Invalid data format”)) {
validLines.push(resultLines[idx]);
}
}

return [{ json: { output: validLines.join(‘\n’) } }];
} else {
return [{ json: { output: “No meeting data available” } }];
}```

It produces a JSON output object like the one below:

[
  {
    "output": "Meeting 1: YYYY-MM-DD HH:MM–YYYY-MM-DD HH:MM...."
  }
]

No matter what I do, I can’t seem to get it into my A.I Agent node. I always get the error:

Using the item method doesn’t work with pinned data in this scenario. Please unpin ‘Busy times’ and try again.

An expression here won’t work because it uses .item and n8n can’t figure out the matching item. You can either:

  • Add the missing information to the node ‘Busy times’
  • Or use .first(), .last() or .all()[index] instead of .item

{{ $(‘Busy times’).item.json.output }} Is how I’m calling it, but I’ve tried other methods. Anyone know what the cause could be here?