Prisma 1 Forum

Variable X got invalid value. Field “0” is not defined by type

Hi, I’ve got this error but I don’t find what’s causing it, the message is a bit confusing. Thank you in advance for your help.

Message: Variable "$activities" got invalid value 
[{"activityType":"DELIVER","description":"Test description","files":
"hasFiles":false,"name":"New Activity","objectiveName":"New objective",
"batchName":"New batch","batchStartDate":"2019-08-19T00:00:00.000Z",
Field "0" is not defined by type FileCreateManyInput at 
value[0].files., Location: [object Object], Path: undefined

Here are the related schema entries:

type Mutation {
  updateBatch(data: BatchUpdateInput!, where: BatchWhereUniqueInput!): Batch

input BatchUpdateInput {
  name: String
  batchID: String
  startDate: DateTime
  finishDate: DateTime
  description: String
  objectives: BatchObjectiveUpdateManyInput
  odes: ODEUpdateManyWithoutBatchesInput
  coordinator: UserUpdateOneRequiredWithoutBatchesInput
  program: ProgramUpdateOneRequiredWithoutBatchesInput

input BatchObjectiveUpdateManyInput {
  create: [BatchObjectiveCreateInput!]
  update: [BatchObjectiveUpdateWithWhereUniqueNestedInput!]
  upsert: [BatchObjectiveUpsertWithWhereUniqueNestedInput!]
  delete: [BatchObjectiveWhereUniqueInput!]
  connect: [BatchObjectiveWhereUniqueInput!]
  set: [BatchObjectiveWhereUniqueInput!]
  disconnect: [BatchObjectiveWhereUniqueInput!]
  deleteMany: [BatchObjectiveScalarWhereInput!]
  updateMany: [BatchObjectiveUpdateManyWithWhereNestedInput!]

input BatchObjectiveCreateInput {
  name: String!
  description: String!
  type: ObjectiveType!
  status: BatchObjectiveStatus!
  startDate: DateTime
  finishDate: DateTime
  activities: ActivityCreateManyInput

input ActivityCreateManyInput {
  create: [ActivityCreateInput!]
  connect: [ActivityWhereUniqueInput!]

input ActivityWhereUniqueInput {
  id: ID

input ActivityCreateInput {
  name: String!
  description: String!
  activityType: ActivityType!
  files: FileCreateManyInput
  hasFiles: Boolean

input FileCreateManyInput {
  create: [FileCreateInput!]
  connect: [FileWhereUniqueInput!]

input FileCreateInput {
  url: String!
  type: String!

input FileWhereUniqueInput {
  id: ID

Here’s the mutation:

mutation($type:ObjectiveType!, $activities: [ActivityCreateInput!]) {
  updateBatch(where:{id:"exampleid"} data: {
        name: "example"
        type: $type
        status: ACTIVE
          create: $activities

I tried solutions posted here but don’t work:

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.