Search

Troubleshooting a Statamic Illegal Offset Type Error when Viewing Collection Entries in the Control Panel

November 30, 2023 —John Koster

On a recent Statamic project I was continuously receiving the following error when attempting to view a collection's entries within the Statamic control panel:

1TypeError
2
3Illegal offset type

Digging through the error's vendor frames I ultimately landed on the following line within vendor/statamic/cms/src/Http/Controllers/CP/Collections/CollectionController.php:

69<?php
70 // ...
71 
72 if (! $blueprint) {
73 throw new LogicException("The {$collection->handle()} collection does not have any visible blueprints. At least one must not be hidden.");
74 }
75 
76 $columns = $blueprint
77 ->columns()
78 ->put('status', Column::make('status')
79 ->listable(true)
80 ->visible(true)
81 ->defaultVisibility(true)
82 ->sortable(false))
83 ->setPreferred("collections.{$collection->handle()}.columns")
84 ->rejectUnlisted()
85 ->values();

This sent me down a rabbit hole of trying to track down this issue.

After a while, I noticed this error was triggered by having a custom language file in my site's lang/en directory named content.php (the language sub-directory wasn't important, as this can be triggered for any language directory, depending on the locale).

Simply renaming my custom content.php language file to something else resolve the issue for me.

Some absolutely amazing
people

The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.