Skip to content
Init is coming / May 19 - 23
Back

"Invalid relationship value. Must be either a document ID or a document, array given.

  • 0
  • Databases
  • Web
  • Cloud
45.Dan
9 May, 2025, 19:03

In my app i am trying to update the documents in my databse from a form in my app, and i am getting this error Error updating event users: AppwriteException: Invalid relationship value. Must be either a document ID or a document, array given. at async updateEventUsers (lib/actions/events.actions.ts:138:29) 136 |
137 | // Update the event document

138 | const updatedEvent = await databases.updateDocument( | ^ 139 | appwriteConfig.databaseId, 140 | appwriteConfig.eventCollectionId, 141 | eventId, { code: 400, type: 'relationship_value_invalid', response: '{"message":"Invalid relationship value. Must be either a document ID or a document, array given.","code":400,"type":"relationship_value_invalid","version":"1.6.2"}' } ⨯ Error: Failed to update event users. Please try again. at updateEventUsers (lib/actions/events.actions.ts:151:14) 149 | } catch (error) { 150 | console.error("Error updating event users:", error); 151 | throw new Error("Failed to update event users. Please try again."); | ^ 152 | } 153 | } 154 | { digest: '2401185207' }

I am tyring to work out if updating relationship attbuties is not something i can do?

TL;DR
Developers are facing an "Invalid relationship value" error when updating documents in a database from a form. The error is caused by providing an array when only a document ID or document is expected. The issue occurs when attempting to update relationship attributes.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more