#32017 closed Bug (invalid)
TypeError: check() got an unexpected keyword argument 'databases'
| Reported by: | Stian Jensen | Owned by: | nobody |
|---|---|---|---|
| Component: | Core (System checks) | Version: | 3.1 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
When updating from django 3.0.10 to 3.1.0 (also 3.1.1), I get a new error when running management commands that involve running system checks.
The whole stack trace involves only django code (no other third-party packages), so I assume this cannot be related to other packages I have installed.
I saw something in the release notes about a new --database flag to the check command, but I cannot piece together if it has anything to do with this error (Running manage.py check with '--database default' does not remove the crash, for instance).
.venv/bin/python manage.py check
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "app/.venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "app/.venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "app/.venv/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "app/.venv/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute
output = self.handle(*args, **options)
File "app/.venv/lib/python3.8/site-packages/django/core/management/commands/check.py", line 63, in handle
self.check(
File "app/.venv/lib/python3.8/site-packages/django/core/management/base.py", line 392, in check
all_issues = checks.run_checks(
File "app/.venv/lib/python3.8/site-packages/django/core/checks/registry.py", line 70, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "app/.venv/lib/python3.8/site-packages/django/core/checks/model_checks.py", line 34, in check_all_models
errors.extend(model.check(**kwargs))
File "app/.venv/lib/python3.8/site-packages/django/db/models/base.py", line 1264, in check
*cls._check_fields(**kwargs),
File "app/.venv/lib/python3.8/site-packages/django/db/models/base.py", line 1343, in _check_fields
errors.extend(field.check(**kwargs))
TypeError: check() got an unexpected keyword argument 'databases'
(I stripped out some of the absolute paths to file names that should be irrelevant from the traceback)
Change History (3)
comment:1 by , 5 years ago
| Resolution: | → needsinfo |
|---|---|
| Status: | new → closed |
comment:2 by , 5 years ago
Hi, after trying to make a reproduce I finally tracked down the issue in our codebase. We have a custom model field where we've overridden the check method to do some extra validation of the field config. That method wasn't setup to take in **kwargs. It seems like something has changed in django 3.1 that now sends databases as a kwarg, so just changing our method signature to check(self, **kwargs): solved the problem.
Thanks, and sorry for the incorrect bug report!
Thanks for this ticket however I cannot reproduce this issue. Can you provide a small project?