<p>Looking at the code where your errors is occurring (line 46 of craft/app/fieldtypes/BaseOptionsFieldType.php), it looks like you have either a Checkboxes or Multi-Select field whose <code>options</code> setting is somehow set, but not set to an array. Not sure how it could have gotten into that state, but that’s the only thing that would explain your error.</p>

<p>Try re-saving any Checkboxes/Multi-Select fields (or if you have any 3rd party field types installed that might be extending Craft’s BaseOptionsFieldType, that would be even more likely the culprit), ensuring they have at least one option set.</p>

CC BY-SA 3.0
2017-09-08T12:51:01.433Z
Great, thanks Brandon. This has fixed the problem. 

A checkbox field was saved with a row but containing no options. Removing the row and saving has fixed. Cheers!
Cole Henley
CC BY-SA 3.0
2017-09-08T12:23:44.137Z
2017-09-08T12:23:44.137Z
Brandon Kelly
<p>We've made a local copy of a site that is working fine in a staging environment but locally is getting the following error: </p>

<pre><code>`Invalid argument supplied for foreach()`
</code></pre>

<p>Seemingly coming from <code>craft/app/fieldtypes/BaseOptionsFieldtype</code>.</p>

<p>Does anybody have any thoughts on what is causing this and how to resolve? Is happening both in the front-end and the admin area. </p>

CC BY-SA 3.0
2017-01-13T22:19:19.357Z
Can you enable devMode and share the full stack trace leading up to that error?
Brad Bell
CC BY-SA 3.0
2017-09-07T14:53:00.133Z
So hit this problem again and cannot recall solution (payback for not posting up here …)

Stack trace as follows:

https://gist.github.com/cole007/a1fa47d90e4b3e125b608ecdf4944681
Cole Henley
CC BY-SA 3.0
2017-09-07T16:07:56.337Z
Regarding above, this follows an upgrade from 2.6.2950 to 2.6.2989

Any thoughts why above upgrade may be causing site not to load?
Also of note is use of custom locales for this site
Cole Henley
CC BY-SA 3.0
2017-09-07T16:34:22.707Z
Is there something past step #10 in the stack trace that tells you the template/line the error is coming from?
Brad Bell
CC BY-SA 3.0
2017-09-08T08:10:42.433Z
updated gist for full stack trace
Cole Henley
<error-message><error>
`Invalid argument supplied for foreach()` error
# `Invalid argument supplied for foreach()` error

(Asked by: username_0 on 2017-01-13)

We've made a local copy of a site that is working fine in a staging environment but locally is getting the following error: 
`Invalid argument supplied for foreach()`

Seemingly coming from craft/app/fieldtypes/BaseOptionsFieldtype.
Does anybody have any thoughts on what is causing this and how to resolve? Is happening both in the front-end and the admin area.

**Tags:** error-message, error
> **Comments:**
> **username_1**: Can you enable devMode and share the full stack trace leading up to that error?  
> **username_0**: So hit this problem again and cannot recall solution (payback for not posting up here …)  Stack trace as follows:  https://gist.github.com/cole007/a1fa47d90e4b3e125b608ecdf4944681  
> **username_0**: Regarding above, this follows an upgrade from 2.6.2950 to 2.6.2989  Any thoughts why above upgrade may be causing site not to load? Also of note is use of custom locales for this site  
> **username_1**: Is there something past step #10 in the stack trace that tells you the template/line the error is coming from?  
> **username_0**: updated gist for full stack trace  

---

## 1 answers

### Answer by username_2 on 2017-09-08. Score: 2 | Accepted answer

Looking at the code where your errors is occurring (line 46 of craft/app/fieldtypes/BaseOptionsFieldType.php), it looks like you have either a Checkboxes or Multi-Select field whose `options` setting is somehow set, but not set to an array. Not sure how it could have gotten into that state, but that’s the only thing that would explain your error.

Try re-saving any Checkboxes/Multi-Select fields (or if you have any 3rd party field types installed that might be extending Craft’s BaseOptionsFieldType, that would be even more likely the culprit), ensuring they have at least one option set.

> **Comments:**
> **username_0**: Great, thanks Brandon. This has fixed the problem.   A checkbox field was saved with a row but containing no options. Removing the row and saving has fixed. Cheers!  

---

