View Issue Details

IDProjectCategoryView StatusLast Update
0006006Talerobsolete componentpublic2021-08-24 16:23
ReporterChristian Grothoff Assigned ToChristian Grothoff  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
Platformi7OSDebian GNU/LinuxOS Versionsqueeze
Product Versiongit (master) 
Target Version0.8Fixed in Version0.8 
Summary0006006: stack trace when adding existing account
DescriptionRunning
$ taler-bank-manage django add_bank_account foi

twice gives:

2019-12-22 14:00:11,865 talerconfig WARNING no base directory found
Operations to perform:
  Apply all migrations: app, auth, contenttypes, sessions
Running migrations:
  No migrations to apply.
Traceback (most recent call last):
  File "/home/euro/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "auth_user_username_key"
DETAIL: Key (username)=(foi) already exists.


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/euro/local/bin/taler-bank-manage", line 177, in <module>
    ARGS.func(ARGS)
  File "/home/euro/local/bin/taler-bank-manage", line 58, in handle_django
    execute_from_command_line([sys.argv[0] + " django"] + args.command)
  File "/home/euro/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/home/euro/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/euro/local/lib/python3.7/site-packages/django/core/management/base.py", line 328, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/euro/local/lib/python3.7/site-packages/django/core/management/base.py", line 369, in execute
    output = self.handle(*args, **options)
  File "/home/euro/local/lib/python3.7/site-packages/talerbank/app/management/commands/add_bank_account.py", line 55, in handle
    username=accountname, password=str(uuid.uuid4())
  File "/home/euro/local/lib/python3.7/site-packages/django/contrib/auth/models.py", line 147, in create_user
    return self._create_user(username, email, password, **extra_fields)
  File "/home/euro/local/lib/python3.7/site-packages/django/contrib/auth/models.py", line 141, in _create_user
    user.save(using=self._db)
  File "/home/euro/local/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 66, in save
    super().save(*args, **kwargs)
  File "/home/euro/local/lib/python3.7/site-packages/django/db/models/base.py", line 746, in save
    force_update=force_update, update_fields=update_fields)
  File "/home/euro/local/lib/python3.7/site-packages/django/db/models/base.py", line 784, in save_base
    force_update, using, update_fields,
  File "/home/euro/local/lib/python3.7/site-packages/django/db/models/base.py", line 886, in _save_table
    results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
  File "/home/euro/local/lib/python3.7/site-packages/django/db/models/base.py", line 925, in _do_insert
    using=using, raw=raw,
  File "/home/euro/local/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/euro/local/lib/python3.7/site-packages/django/db/models/query.py", line 1204, in _insert
    return query.get_compiler(using=using).execute_sql(returning_fields)
  File "/home/euro/local/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1377, in execute_sql
    cursor.execute(sql, params)
  File "/home/euro/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 100, in execute
    return super().execute(sql, params)
  File "/home/euro/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 68, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/home/euro/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/home/euro/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
    return self.cursor.execute(sql, params)
  File "/home/euro/local/lib/python3.7/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/home/euro/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.IntegrityError: duplicate key value violates unique constraint "auth_user_username_key"
DETAIL: Key (username)=(foi) already exists.

Additional InformationWhat should happen is basically given in the last line of the output: a brief (possibly nicer!) message saying "account exists" and a non-zero status code. Please NEVER throw exceptions at the user.
TagsNo tags attached.

Activities

Christian Grothoff

2020-08-29 19:53

manager   ~0016799

I just tested this, and it must have already been fixed by someone in the past. I now get a proper error message ;-).

Issue History

Date Modified Username Field Change
2019-12-22 14:05 Christian Grothoff New Issue
2019-12-22 14:05 Christian Grothoff Status new => assigned
2019-12-22 14:05 Christian Grothoff Assigned To => Marcello Stanisci
2020-03-29 21:46 Christian Grothoff Target Version 0.7.0 => 0.7.1
2020-08-29 14:00 Christian Grothoff Assigned To Marcello Stanisci => Christian Grothoff
2020-08-29 14:05 Christian Grothoff Target Version 0.7.1 => 0.8
2020-08-29 19:53 Christian Grothoff Status assigned => resolved
2020-08-29 19:53 Christian Grothoff Resolution open => fixed
2020-08-29 19:53 Christian Grothoff Fixed in Version => 0.8
2020-08-29 19:53 Christian Grothoff Note Added: 0016799
2021-08-24 16:23 Christian Grothoff Status resolved => closed
2022-08-23 20:26 Christian Grothoff Category bank (demonstrator) => py bank (demonstrator, obsolete)
2023-12-03 01:23 Christian Grothoff Category py bank (demonstrator, obsolete) => obsolete componet
2023-12-11 20:08 Florian Dold Category obsolete componet => obsolete component