> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zapier.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Error: An array is expected

> When you add a polling trigger or search action to your integration, the Zapier platform [expects a bare array of new or found items returned](/integrations/build/response-types), sorted in reverse chronological order. An API may instead return a result _object_ that contains the array of items the trigger/search needs.

## Error shown

For example, for a “Find Issue” search action with GitHub's API, we might start with a `https://api.github.com/repos/{{bundle.inputData.owner}}/ {{bundle.inputData.repo}}/issues/{{bundle.inputData.issue_number}}` request:

<Frame>
  {" "}

  <img src="https://mintcdn.com/zapier-82f0e938/ziHY4Q2Lym35bUQM/images/a5516cc30abee4f84a58ac5b7b3dfc76.webp?fit=max&auto=format&n=ziHY4Q2Lym35bUQM&q=85&s=ac6fb4a8108d66b02e9f5eb3f1108b79" width="1229" height="401" data-path="images/a5516cc30abee4f84a58ac5b7b3dfc76.webp" />

  {" "}
</Frame>

When tested, Zapier will show an error message `Results must be an array, got: object,`

<Frame>
  {" "}

  <img src="https://mintcdn.com/zapier-82f0e938/1jtyk4mqAs_J-p30/images/2461b0e7f49ecf5aed90d429a59ad2bf.webp?fit=max&auto=format&n=1jtyk4mqAs_J-p30&q=85&s=06cde1cd6e874a8c397be273e4f0dfba" width="1215" height="925" data-path="images/2461b0e7f49ecf5aed90d429a59ad2bf.webp" />

  {" "}
</Frame>

Check the API response in the HTTP tab of the *[Test your API Request](/integrations/build/test-triggers-actions)* section, and you'll see an *object* that contains the array of items we need was returned, not the array itself:

<Frame>
  {" "}

  <img src="https://mintcdn.com/zapier-82f0e938/2ebL4bG5uJP5JVc0/images/d569e3a05f643a9a199b5d85dc4a4fc2.webp?fit=max&auto=format&n=2ebL4bG5uJP5JVc0&q=85&s=a3f9044ec76524e9aaf2e40b1106610f" width="1144" height="961" data-path="images/d569e3a05f643a9a199b5d85dc4a4fc2.webp" />

  {" "}
</Frame>

## Solution

Instead, return that array of channels to Zapier. To do that switch to [Code Mode](/integrations/build/code-mode) in your request. That will allow you to provide a JavaScript function to handle the request, and make needed changes to the structure or content of the result before returning data to the Zapier platform.

For this request, wrap the response with an array instead of the default `return results`, to have Zapier return an array of issues.

<Frame>
  {" "}

  <img src="https://mintcdn.com/zapier-82f0e938/88BoWUuO1MROWn5-/images/3bec13fa502f47ff1e5f9bfded052b4d.webp?fit=max&auto=format&n=88BoWUuO1MROWn5-&q=85&s=2f57c7632c52f98e5e00237ebda532b9" width="1223" height="705" data-path="images/3bec13fa502f47ff1e5f9bfded052b4d.webp" />

  {" "}
</Frame>

> Remember: [Code Mode](/integrations/build/code-mode) is a toggle; if you switch back to Form Mode your code will be ignored!

Now, retest the request and it should run successfully.

<Frame>
  {" "}

  <img src="https://mintcdn.com/zapier-82f0e938/ziHY4Q2Lym35bUQM/images/af56c7fed5183aed462d2e7efbf78f8c.webp?fit=max&auto=format&n=ziHY4Q2Lym35bUQM&q=85&s=a1dd806729d99a6828aabf6bca218018" width="1226" height="644" data-path="images/af56c7fed5183aed462d2e7efbf78f8c.webp" />

  {" "}
</Frame>

***

*Need help? [Tell us about your problem](https://developer.zapier.com/contact) and we'll connect you with the right resource or contact support.*
