{"record":{"id":"1db66f95c43c22eb","repo":"keras-team/keras","slug":"must-specify-exactly-two-of-left-cropping-right-c","errorCode":null,"errorMessage":"Must specify exactly two of left_cropping, right_cropping, target_width. Received: left_cropping={left_cropping}, right_cropping={right_cropping}, target_width={target_width}","messagePattern":"Must specify exactly two of left_cropping, right_cropping, target_width\\. Received: left_cropping=(.+?), right_cropping=(.+?), target_width=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/ops/image.py","lineNumber":1589,"sourceCode":"\ndef _validate_crop_images_args(\n    top_cropping,\n    left_cropping,\n    bottom_cropping,\n    right_cropping,\n    target_height,\n    target_width,\n):\n    if [top_cropping, bottom_cropping, target_height].count(None) != 1:\n        raise ValueError(\n            \"Must specify exactly two of \"\n            \"top_cropping, bottom_cropping, target_height. \"\n            f\"Received: top_cropping={top_cropping}, \"\n            f\"bottom_cropping={bottom_cropping}, \"\n            f\"target_height={target_height}\"\n        )\n    if [left_cropping, right_cropping, target_width].count(None) != 1:\n        raise ValueError(\n            \"Must specify exactly two of \"\n            \"left_cropping, right_cropping, target_width. \"\n            f\"Received: left_cropping={left_cropping}, \"\n            f\"right_cropping={right_cropping}, \"\n            f\"target_width={target_width}\"\n        )\n\n    _validate_non_negative(top_cropping, \"top_cropping\")\n    _validate_non_negative(bottom_cropping, \"bottom_cropping\")\n    _validate_non_negative(target_height, \"target_height\")\n    _validate_non_negative(left_cropping, \"left_cropping\")\n    _validate_non_negative(right_cropping, \"right_cropping\")\n    _validate_non_negative(target_width, \"target_width\")\n\n\nclass PadImages(Operation):\n    def __init__(\n        self,","sourceCodeStart":1571,"sourceCodeEnd":1607,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/ops/image.py#L1571-L1607","documentation":"Width triple rule for crop_images: exactly two of left_cropping, right_cropping, target_width must be given; anything else raises at output-spec/validation time.","triggerScenarios":"crop_images with width args specified 0, 1, or 3 times, e.g. only target_width=224.","commonSituations":"Same shape as the height variant: partial configs, typo'd keys, mixing pad/crop kwargs.","solutions":["Provide exactly two, e.g. target_width=224, left_cropping=0","Symmetric: left_cropping=c, right_cropping=c","Validate width independently of height"],"exampleFix":"# before\nout = crop_images(img, target_height=224, top_cropping=0)  # width underdetermined\n\n# after\nout = crop_images(img, target_height=224, top_cropping=0, target_width=224, left_cropping=0)","handlingStrategy":"validation","validationCode":"assert [left_cropping, right_cropping, target_width].count(None) == 1","typeGuard":"def crop_width_triple_ok(l, r, tw) -> bool:\n    return [l, r, tw].count(None) == 1","tryCatchPattern":null,"preventionTips":["Validate both crop axes together","Watch for typos in kwargs silently yielding None"],"tags":["keras","image","cropping","argument-validation"],"backgroundTag":"missing-or-conflicting-arguments","analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}