View Issue Details

IDProjectCategoryView StatusLast Update
0006006Talerobsolete componentpublic2021-08-24 14:23
ReporterChristian Grothoff Assigned ToChristian Grothoff Resolution deadline
ImplementerReviewer 
Release signed byDeployed by 
VerifierCommunicator 
Data protection authority notification requiredNo  
CSIRT notification requiredNo  
Estimated effort (hours)Actual effort (hours)0 
Fast-trackNo
Work packagenone
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.

Required notifications

Address or linkRemarkAdded byNotifiedActions

Activities

Christian Grothoff

2020-08-29 17: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 ModifiedUsernameFieldChange
2019-12-22 13:05Christian GrothoffNew Issue
2019-12-22 13:05Christian GrothoffStatusnew => assigned
2019-12-22 13:05Christian GrothoffAssigned To => Marcello Stanisci
2020-03-29 19:46Christian GrothoffTarget Version0.7.0 => 0.7.1
2020-08-29 12:00Christian GrothoffAssigned ToMarcello Stanisci => Christian Grothoff
2020-08-29 12:05Christian GrothoffTarget Version0.7.1 => 0.8
2020-08-29 17:53Christian GrothoffStatusassigned => informing
2020-08-29 17:53Christian GrothoffResolutionopen => fixed
2020-08-29 17:53Christian GrothoffFixed in Version => 0.8
2020-08-29 17:53Christian GrothoffNote Added: 0016799
2021-08-24 14:23Christian GrothoffStatusinforming => closed
2022-08-23 18:26Christian GrothoffCategorybank (demonstrator) => py bank (demonstrator, obsolete)
2023-12-03 00:23Christian GrothoffCategorypy bank (demonstrator, obsolete) => obsolete componet
2023-12-11 19:08Florian DoldCategoryobsolete componet => obsolete component