{"record":{"id":"31c0de8f30fe274c","repo":"go-gorm/gorm","slug":"unknown-association-operation-type-v","errorCode":null,"errorMessage":"unknown association operation type: %v","messagePattern":"unknown association operation type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"generics.go","lineNumber":755,"sourceCode":"\t\tvar r T\n\t\treturn s.c.g.apply(ctx).Model(r).Create(data).Error\n\t}\n\n\treturn nil\n}\n\n// executeAssociationOperation executes an association operation\nfunc (s setCreateOrUpdateG[T]) executeAssociationOperation(ctx context.Context, op clause.Association) error {\n\tvar r T\n\tbase := s.c.g.apply(ctx).Model(r)\n\n\tswitch op.Type {\n\tcase clause.OpCreate:\n\t\treturn s.handleAssociationCreate(ctx, base, op)\n\tcase clause.OpUnlink, clause.OpDelete, clause.OpUpdate:\n\t\treturn s.handleAssociation(ctx, base, op)\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown association operation type: %v\", op.Type)\n\t}\n}\n\nfunc (s setCreateOrUpdateG[T]) handleAssociationCreate(ctx context.Context, base *DB, op clause.Association) error {\n\tif len(op.Set) > 0 {\n\t\treturn s.handleAssociationForOwners(base, ctx, func(owner T, assoc *Association) error {\n\t\t\tdata := make(map[string]interface{}, len(op.Set))\n\t\t\tfor _, a := range op.Set {\n\t\t\t\tdata[a.Column.Name] = a.Value\n\t\t\t}\n\t\t\treturn assoc.Append(data)\n\t\t}, op.Association)\n\t}\n\n\treturn s.handleAssociationForOwners(base, ctx, func(owner T, assoc *Association) error {\n\t\treturn assoc.Append(op.Values...)\n\t}, op.Association)\n}","sourceCodeStart":737,"sourceCodeEnd":773,"githubUrl":"https://github.com/go-gorm/gorm/blob/1d6ce99528060be18a42be09aca8d39efcb47f28/generics.go#L737-L773","documentation":"Error \"unknown association operation type: %v\" thrown in go-gorm/gorm.","triggerScenarios":"Thrown at generics.go:755 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a supported association operation: Append, Replace, Delete, Clear, or Count.","Check the value passed to the association mode call is one of the documented operation types.","Upgrade GORM if the operation was introduced in a newer version."],"exampleFix":"Use a supported association mode (Replace/Append/Delete/Clear) instead of an unknown operation type.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1d6ce99528060be18a42be09aca8d39efcb47f28","analyzedAt":"2026-08-15T13:01:23.433Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}