When building a site with lots of fields, using features, I got this Fatal error:

FieldUpdateForbiddenException: Cannot update a list field to not include keys with existing data. in list_field_update_forbid() (line 350 of /.../modules/field/modules/list/list.module).

Unfortunately, the error message gives _no_ clue as to which field is causing the update error.

The attached patch simply adds the field name to the error message, as the $field variable is already in scope, it's a trivial change but helps the debug process immensely.

Same example with patch

FieldUpdateForbiddenException: Cannot update a list field (field_somefield_name_here) to not include keys with existing data. in list_field_update_forbid() (line 350 of /.../modules/field/modules/list/list.module).

See attached.

DT

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

marcingy’s picture

Version: 7.x-dev » 8.x-dev
Category: feature » task
Issue tags: +Needs backport to D7

I'm thinking this is really a task, it needs to go into d8 first on the surface the message seems ok but I'd like more input from others before rtbcing.

larowlan’s picture

Status: Needs review » Reviewed & tested by the community

Got caught with this one too.

webchick’s picture

Status: Reviewed & tested by the community » Needs work

Fix makes sense. The grammar in that sentence is frightfully awkward. Since we're breaking the string anyway, can we make it something like:

"A list field (@field_name) with existing data cannot have its keys changed."

budda’s picture

Status: Needs work » Needs review
FileSize
943 bytes

Also caught by this confusing message
Improved error message. Drupal 8 patch attached.

budda’s picture

And for Drupal 7 the same patch attached (but with the right file structure).

Status: Needs review » Needs work

The last submitted patch, drupal-improved_error_reporting_7.x-1294264-5.patch, failed testing.

budda’s picture

Status: Needs work » Reviewed & tested by the community

Patch on comment 4 is for drupal 8 and implements the requested string change from comment 3.

Dries’s picture

Status: Reviewed & tested by the community » Needs work

The wrapping seems to violate our coding standards.

budda’s picture

Assigned: Unassigned » budda
Status: Needs work » Needs review
FileSize
894 bytes

I've removed all wrapping as the line isn't as long as others in the same list.module

Using Features in D7 seems to kick this error up frequently so will be happy when it's in and back-ported so it makes some sense!

marcingy’s picture

Status: Needs review » Reviewed & tested by the community

Looks good only change from #5 is wrapping

budda’s picture

I've got the Drupal 7 backport patch ready to upload here too. That's the one I want sooner.

budda’s picture

catch’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Looks good. Committed/pushed to 8.x. Moving back to 7.x for backport. This is a string change, but it's also an error message so seems OK to tweak.

budda’s picture

Status: Patch (to be ported) » Needs review
FileSize
874 bytes

Attached is the Drupal 7.x version of the message patch.

budda’s picture

Status: Needs review » Reviewed & tested by the community

The patch is the same as the already reviewed and committed Drupal 8.x one, except on a different file path.
We're using it already internally at Ixis without problems for past 3 weeks.

xjm’s picture

Hmm, I thought error messages were the worst strings to break translations for? So I'm not sure we can backport this.

budda’s picture

It's a technical error message rather than a user interface string. So not being covered by a translation doesn't seem so critical?

budda’s picture

.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Yeah, generally we aren't supposed to backport these, however in this case the error message is so unhelpful as to be considered a bug.

Committed and pushed to 7.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

webchick’s picture

Issue tags: +7.13 release notes

x

webchick’s picture

Issue summary: View changes

Formatting fix