{"record":{"id":"34372b1f122abb16","repo":"matplotlib/matplotlib","slug":"got-unknown-shape-self-shape-r","errorCode":null,"errorMessage":"Got unknown shape: {self._shape!r}","messagePattern":"Got unknown shape: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/matplotlib/patches.py","lineNumber":1633,"sourceCode":"                left_half_arrow += [head_length, 0]\n            # if the head starts at 0, shift up by another head length\n            if self._head_starts_at_zero:\n                left_half_arrow += [head_length / 2, 0]\n            # figure out the shape, and complete accordingly\n            if self._shape == 'left':\n                coords = left_half_arrow\n            else:\n                right_half_arrow = left_half_arrow * [1, -1]\n                if self._shape == 'right':\n                    coords = right_half_arrow\n                elif self._shape == 'full':\n                    # The half-arrows contain the midpoint of the stem,\n                    # which we can omit from the full arrow. Including it\n                    # twice caused a problem with xpdf.\n                    coords = np.concatenate([left_half_arrow[:-1],\n                                             right_half_arrow[-2::-1]])\n                else:\n                    raise ValueError(f\"Got unknown shape: {self._shape!r}\")\n            if distance != 0:\n                cx = self._dx / distance\n                sx = self._dy / distance\n            else:\n                # Account for division by zero\n                cx, sx = 0, 1\n            M = [[cx, sx], [-sx, cx]]\n            self.verts = np.dot(coords, M) + [\n                self._x + self._dx,\n                self._y + self._dy,\n            ]\n\n\n_docstring.interpd.register(\n    FancyArrow=\"\\n\".join(\n        (inspect.getdoc(FancyArrow.__init__) or \"\").splitlines()[2:]))\n\n","sourceCodeStart":1615,"sourceCodeEnd":1651,"githubUrl":"https://github.com/matplotlib/matplotlib/blob/b379c1b69e012b142c0f496a52bcb30513802d72/lib/matplotlib/patches.py#L1615-L1651","documentation":"patches.FancyArrow(x, y, dx, dy, ...) draws the shaft plus head halves selected by its shape parameter, which may only be 'full', 'left', or 'right'. _get_path's geometry code falls through to raise ValueError(f\"Got unknown shape: {self._shape!r}\") for any other value, at construction/draw time.","triggerScenarios":"FancyArrow(0, 0, 1, 1, shape='both') or shape='halves'; typos like shape='ful'; passing head-orientation strings from other APIs (e.g. '<|-|>' annotation styles); passing None.","commonSituations":"Confusing FancyArrow's shape with annotate/FancyArrowPatch arrowstyle strings; exposing a user 'arrow head side' option without validation; copy-pasting from examples using different libraries (plotly's 'head' vocabulary).","solutions":["Use one of 'full' (default), 'left', or 'right'.","Validate free-form input against the allowed set before constructing.","For richer head styles (open heads, filled variants, mutation_scale), switch to FancyArrowPatch with arrowstyle, or ax.annotate.","Check for typos — this is the most common single cause."],"exampleFix":"# before\narrow = patches.FancyArrow(0, 0, 1, 0.5, width=0.05, shape='both')\n\n# after\narrow = patches.FancyArrow(0, 0, 1, 0.5, width=0.05, shape='full')\n# or richer styling: patches.FancyArrowPatch((0, 0), (1, 0.5), arrowstyle='<|-|>', mutation_scale=15)","handlingStrategy":"validation","validationCode":"shape = shape if shape in ('full', 'left', 'right') else 'full'\narrow = patches.FancyArrow(x, y, dx, dy, shape=shape)","typeGuard":"def is_valid_arrow_shape(s) -> bool:\n    return s in ('full', 'left', 'right')","tryCatchPattern":null,"preventionTips":["Whitelist user input to {'full', 'left', 'right'} before constructing FancyArrow.","For advanced head styles use FancyArrowPatch(arrowstyle=...) or annotate, not shape strings.","Watch for typos — 'ful' and 'both' are the usual offenders."],"tags":["matplotlib","patches","fancyarrow","enum","argument-validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"b379c1b69e012b142c0f496a52bcb30513802d72","analyzedAt":"2026-08-21T23:31:55.468Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}