{"record":{"id":"4e29dfafe3731b8a","repo":"aosabook/500lines","slug":"your-contraints-are-too-harsh-please-relax","errorCode":null,"errorMessage":"Your contraints are too harsh. Please relax.","messagePattern":"Your contraints are too harsh\\. Please relax\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"incomplete/typesetting-engine/breakpoints.py","lineNumber":138,"sourceCode":"                    self.add_block(character='-', block_type=Type.penalty,\n                                   width=0,\n                                   penalty=50, flag=True)\n            last_seen_character = character\n        self.add_forced_break_blocks()\n\n    def compute_breakpoints(self):\n        \"\"\"Compute the best possible breakpoints.\n\n        Basically, it determines the shortest path in a directed\n        acyclic graph while constructing it.\"\"\"\n        for block in self.blocks:\n            if block.type is Type.box:\n                self.current_width += block.width\n            if self.is_legal_breakpoint(block):\n                # self.verbose(block.position)\n                self.find_best_previous_breakpoints(block)\n                if not self.first_candidate:\n                    raise Exception(\n                        'Your contraints are too harsh. Please relax.')\n            if block.type is Type.glue:\n                self.current_width += block.width\n                self.current_stretch += block.stretch\n                self.current_shrink += block.shrink\n        best_candidate = self.choose_best_candidate()\n        if ADJUSTMENT != 0:\n            best_candidate = self.choose_adjusted_candidate(best_candidate)\n        self.breakpoints = (\n            [-1] + self.determine_breakpoint_sequence(best_candidate))\n\n    def find_best_previous_breakpoints(self, block):\n        \"\"\"For a certain block that is a legal breakpoint, compute the\n        best previous breakpoint possible among the linked list of\n        candidates.\"\"\"\n        current_last_breakpoint = self.first_candidate\n        self.previous_candidate = None\n        while current_last_breakpoint:","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/aosabook/500lines/blob/fba689d101eb5600f5c8f4d7fd79912498e950e2/incomplete/typesetting-engine/breakpoints.py#L120-L156","documentation":"Error \"Your contraints are too harsh. Please relax.\" thrown in aosabook/500lines.","triggerScenarios":"Thrown at incomplete/typesetting-engine/breakpoints.py:138 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Relax the badness/tolerance constraints so at least one legal breakpoint sequence exists.","Add more legal breakpoints (glue/penalty blocks) between boxes so lines can be broken.","Check that line widths are not smaller than the widest unbreakable box."],"exampleFix":"breakpoints = Breakpoints(blocks, line_width, tolerance=2)  # raise tolerance from 1 to 2 to allow looser fits","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fba689d101eb5600f5c8f4d7fd79912498e950e2","analyzedAt":"2026-08-13T06:26:32.792Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}