{"record":{"id":"5cca64d9d3bc73c5","repo":"aosabook/500lines","slug":"arguments-to-project-tasks-must-be-immutable-and-h","errorCode":null,"errorMessage":"arguments to project tasks must be immutable and hashable, not the {}","messagePattern":"arguments to project tasks must be immutable and hashable, not the (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"contingent/code/contingent/projectlib.py","lineNumber":203,"sourceCode":"    return function.__name__, args\n\nclass Task(namedtuple('Task', ('task_function', 'args'))):\n    \"\"\"Turn a call to a function into a task 2-tuple.\n\n    Given a task function and an argument list, returns a task 2-tuple\n    that encapsulates the call as a single object. `Project` uses these\n    task objects for consequence tracking and caching.\n\n    Raises `ValueError` if `args` is not hashable.\n\n    \"\"\"\n    __slots__ = ()\n\n    def __new__(cls, task_function, args):\n        try:\n            hash(args)\n        except TypeError as e:\n            raise ValueError('arguments to project tasks must be immutable'\n                             ' and hashable, not the {}'.format(e))\n\n        return super().__new__(cls, task_function, args)\n\n    def __repr__(self):\n        \"Produce a “syntactic,” source-like representation of the task.\"\n\n        return '{}({})'.format(self.task_function.__name__,\n                               ', '.join(repr(arg) for arg in self.args))\n","sourceCodeStart":185,"sourceCodeEnd":213,"githubUrl":"https://github.com/aosabook/500lines/blob/fba689d101eb5600f5c8f4d7fd79912498e950e2/contingent/code/contingent/projectlib.py#L185-L213","documentation":"Error \"arguments to project tasks must be immutable and hashable, not the {}\" thrown in aosabook/500lines.","triggerScenarios":"Thrown at contingent/code/contingent/projectlib.py:203 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass only immutable, hashable argument types (str, int, tuple, frozenset) to project task functions.","Convert mutable arguments like lists or dicts to tuples/frozensets before creating the task.","Do not pass objects whose __hash__ changes over time, since tasks are cached by hash."],"exampleFix":"task(project.read_files, (tuple(filenames),))  # tuple(...) instead of the mutable list","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"}