{"data":{"id":"magento2-40459","source":"github-pr","sourceRef":"magento/magento2#40459","title":"REST API Attribute Update fails without attribute_id","pr":{"number":40459,"url":"https://github.com/magento/magento2/pull/40459","author":"cmuench","mergedAt":"2026-06-25T11:59:10Z","mergeCommit":"f60e189088e14b685c58075381f8449c5414b8f3","headCommit":"a0348c6fb44ab48b73ec27daa8c76a4dfb19a260","baseRef":"2.4-develop","diffSha256":"00264a8a02f246956463f5c907f681e56aab1935918c9dcb59aa7cc5940f1a27"},"issues":[{"number":40458,"url":"https://github.com/magento/magento2/issues/40458","title":"REST API Attribute Update fails without attribute_id","labels":["Area: APIs","Component: Api","Issue: Confirmed","Priority: P2","Progress: PR Created","Progress: done","Reported on 2.4.8-p3","Reproduced on 2.4.x"],"kind":"human"}],"fixedIn":null,"containingTags":[],"reportedOn":"2.4.8-p3","codeMatch":{"2.4.6":"clean","2.4.6-p1":"clean","2.4.6-p2":"clean","2.4.6-p3":"clean","2.4.6-p4":"clean","2.4.6-p5":"clean","2.4.6-p6":"clean","2.4.6-p7":"clean","2.4.6-p8":"clean","2.4.6-p9":"clean","2.4.6-p10":"clean","2.4.6-p11":"clean","2.4.6-p12":"clean","2.4.6-p13":"clean","2.4.6-p14":"clean","2.4.6-p15":"clean","2.4.7":"clean","2.4.7-p1":"clean","2.4.7-p2":"clean","2.4.7-p3":"clean","2.4.7-p4":"clean","2.4.7-p5":"clean","2.4.7-p6":"clean","2.4.7-p7":"clean","2.4.7-p8":"clean","2.4.7-p9":"clean","2.4.7-p10":"clean","2.4.8":"clean","2.4.8-p1":"clean","2.4.8-p2":"clean","2.4.8-p3":"clean","2.4.8-p4":"clean","2.4.8-p5":"clean","2.4.9":"clean"},"affectedVersions":["2.4.6","2.4.6-p1","2.4.6-p2","2.4.6-p3","2.4.6-p4","2.4.6-p5","2.4.6-p6","2.4.6-p7","2.4.6-p8","2.4.6-p9","2.4.6-p10","2.4.6-p11","2.4.6-p12","2.4.6-p13","2.4.6-p14","2.4.6-p15","2.4.7","2.4.7-p1","2.4.7-p2","2.4.7-p3","2.4.7-p4","2.4.7-p5","2.4.7-p6","2.4.7-p7","2.4.7-p8","2.4.7-p9","2.4.7-p10","2.4.8","2.4.8-p1","2.4.8-p2","2.4.8-p3","2.4.8-p4","2.4.8-p5","2.4.9"],"components":["magento/module-catalog"],"files":[{"path":"app/code/Magento/Catalog/Model/Product/Attribute/Repository.php","change":"modified","package":"magento/module-catalog"}],"stripped":{"tests":["app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/RepositoryTest.php"],"docs":[],"outsideCode":[]},"linesChanged":25,"mergeBatched":false,"excluded":null,"sections":{"description":"Response 400 Bad Request:","stepsToReproduce":"**Update without attribute_id**\n1. Send a `PUT` request to `/V1/products/attributes/{attributeCode}`.\n2. In the payload, include `attribute_code` but omit `attribute_id`.\n\nCan be tested e.g. with the \"color\" attribute.","expectedResult":"The API should recognize the existing attribute by `attribute_code` from the URL and perform an update.","actualResult":"Response 400 Bad Request:\n\n```json\n{\n  \"message\": \"%1 already exists.\",\n  \"parameters\": [\n    \"Attribute with the same code\"\n  ]\n}\n```","source":"issue"},"signatures":[],"labels":{"area":["APIs"],"component":["Api"],"priority":"P2","severity":null,"reportedOn":["2.4.8-p3"]},"categories":["Web API"],"triage":{"model":"@cf/cloudflare/clef","requestHash":"77619c9006124c1ca466f983866c574794a4724ba729448d99d6f7557b3cd4df","isBugfix":0.9773,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9491,"feature":0.0101,"refactor":0.0125,"tests_only":0.009,"docs_only":0.0042,"dependency":0.0045,"cleanup":0.0106},"confidence":0.8848},"scope":{"score":1.2995,"probabilities":{"0":0.1557,"1":0.3891,"2":0.4552},"confidence":0.0743},"risk":{"score":0.4141,"probabilities":{"0":0.6497,"1":0.2865,"2":0.0638},"confidence":0.2624},"area":{"choice":"catalog","probabilities":{"catalog":0.5801,"checkout":0.0037,"customer":0.0033,"admin":0.0167,"graphql_api":0.3766,"framework":0.008,"frontend":0.0037,"other":0.0079},"confidence":0.4044},"securityRelevant":0.007,"reportedVersion":{"choice":"2.4.8-p3","probabilities":{"2.4.0":0.0024,"2.4.0-p1":0.0024,"2.4.1":0.0025,"2.4.1-p1":0.0025,"2.4.2":0.0024,"2.4.2-p1":0.0024,"2.4.2-p2":0.0024,"2.4.3":0.0026,"2.4.3-p1":0.0028,"2.4.3-p2":0.003,"2.4.3-p3":0.0031,"2.4.4":0.0027,"2.4.4-p1":0.0025,"2.4.4-p10":0.0028,"2.4.4-p11":0.0033,"2.4.4-p12":0.0033,"2.4.4-p13":0.0037,"2.4.4-p14":0.0031,"2.4.4-p15":0.0031,"2.4.4-p16":0.0032,"2.4.4-p17":0.0033,"2.4.4-p18":0.0029,"2.4.4-p2":0.0023,"2.4.4-p3":0.0023,"2.4.4-p4":0.0023,"2.4.4-p5":0.0024,"2.4.4-p6":0.0029,"2.4.4-p7":0.0026,"2.4.4-p8":0.0033,"2.4.4-p9":0.0027,"2.4.5":0.0027,"2.4.5-p1":0.0026,"2.4.5-p10":0.0026,"2.4.5-p11":0.0029,"2.4.5-p12":0.0038,"2.4.5-p13":0.0032,"2.4.5-p14":0.0033,"2.4.5-p15":0.0028,"2.4.5-p16":0.003,"2.4.5-p17":0.0028,"2.4.5-p2":0.0028,"2.4.5-p3":0.0031,"2.4.5-p4":0.0029,"2.4.5-p5":0.003,"2.4.5-p6":0.0033,"2.4.5-p7":0.0034,"2.4.5-p8":0.0037,"2.4.5-p9":0.0024,"2.4.6":0.0034,"2.4.6-p1":0.0032,"2.4.6-p10":0.0041,"2.4.6-p11":0.0048,"2.4.6-p12":0.0049,"2.4.6-p13":0.0043,"2.4.6-p14":0.0046,"2.4.6-p15":0.0037,"2.4.6-p2":0.0027,"2.4.6-p3":0.0035,"2.4.6-p4":0.0048,"2.4.6-p5":0.0038,"2.4.6-p6":0.0056,"2.4.6-p7":0.0055,"2.4.6-p8":0.0048,"2.4.6-p9":0.0029,"2.4.7":0.0047,"2.4.7-p1":0.0048,"2.4.7-p10":0.005,"2.4.7-p2":0.0037,"2.4.7-p3":0.0057,"2.4.7-p4":0.0064,"2.4.7-p5":0.0049,"2.4.7-p6":0.0079,"2.4.7-p7":0.0046,"2.4.7-p8":0.005,"2.4.7-p9":0.0029,"2.4.8":0.0496,"2.4.8-p1":0.0043,"2.4.8-p2":0.0122,"2.4.8-p3":0.6296,"2.4.8-p4":0.0184,"2.4.8-p5":0.0146,"2.4.9":0.0072,"unspecified":0.0044},"confidence":0.3934},"backportWorthy":{"score":1.5515,"probabilities":{"0":0.0924,"1":0.2637,"2":0.6439},"confidence":0.239}},"curated":{"title":"Fixes the REST attribute update failing without attribute_id","description":"PUT /V1/products/attributes/:code without attribute_id in the payload attempted to create a new attribute, resulting in a duplicate code error. Numeric option IDs missing from the database also caused a SQL Integrity Constraint Violation. The fix resolves attribute_id from the attribute code and treats invalid option IDs as new options.","categories":["Web API"],"author":"claude-code/opus-5.5","date":"2026-10-06","reviewedBy":null},"tests":{"2.4.8-p5":{"before":"not-runnable","after":"error","adapted":false,"runAt":"2026-10-06T09:20:17.918Z","releaseCommit":"870a22c63d9d9b68fa3297962e2d5d5841115814","suites":{"unit":{"before":"not-runnable","after":"error","runAt":"2026-10-06T09:20:17.918Z"}}},"2.4.9":{"before":"pass","after":"error","adapted":false,"runAt":"2026-10-06T09:20:19.500Z","releaseCommit":"755e34dd689021c5165db9d35ecff74f7dc51527","suites":{"unit":{"before":"pass","after":"error","runAt":"2026-10-06T09:20:19.500Z"}}},"2.4.7-p10":{"before":"not-runnable","after":"error","adapted":false,"runAt":"2026-10-06T09:29:30.220Z","releaseCommit":"72561bf80652f57cc642a03e2c9a51d74a285b14","suites":{"unit":{"before":"not-runnable","after":"error","runAt":"2026-10-06T09:29:30.220Z"}}}}},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-40459 details"}