question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error from autoname of Access Logs

See original GitHub issue

Problem

Trying to open a private file, I got this error:

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 324, in db_insert
    ), list(d.values()))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database/database.py", line 156, in sql
    self._cursor.execute(query, values)
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/cursors.py", line 170, in execute
    result = self._query(query)
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/cursors.py", line 328, in _query
    conn.query(q)
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py", line 517, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py", line 732, in _read_query_result
    result.read()
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py", line 1075, in read
    first_packet = self.connection._read_packet()
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py", line 684, in _read_packet
    packet.check_error()
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/protocol.py", line 220, in check_error
    err.raise_mysql_exception(self._data)
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.IntegrityError: (1062, "Duplicate entry 'AL-00302' for key 'PRIMARY'")
  • The most recent Access Log had the name AL-00810.
  • Autoname for Access Log was defined as “format:AL-{#####}”.
  • There was no row like "AL%" in tabSeries.

I wanted to correct the Naming Series but it didn’t show up in the Naming Series Tool.

Workaround

The following two SQL statements fixed the problem for me:

UPDATE `tabDocType` SET autoname = 'AL-.#####' WHERE name = "Access Log";
INSERT INTO tabSeries VALUES ('AL-', 810);
COMMIT;

After this, I did a bench clear-cache && bench restart.

I can show very clearly that when I change Access Log’s autoname to format:AL-{#####} the error comes back again.

Versions

frappe v12.4.1 (version-12) erpnext v12.6.0 (version-12)

Discuss: https://discuss.erpnext.com/t/pdf-shows-only-body/60447

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ankushcommented, Dec 31, 2021

Noticed this too. Let’s just drop the naming series fully from logs? It’s not really required.

0reactions
ankushcommented, Oct 27, 2022

Removed naming series from access logs. Doesn’t make sense to make logging sequential 😆

https://github.com/frappe/frappe/pull/16823

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set name AutoCorrect options - Microsoft Support
If Access does not complete the process of tracking changes or removing name maps, it logs the error in the Name AutoCorrect Save...
Read more >
PDF shows only {{ body }} - Bug - ERPNext Forum
I can show very clearly that when I change Access Log's autoname to format:AL-{#####} the error comes back again.
Read more >
Troubleshooting Email Delivery with Exchange Server ...
How to use Exchange Server protocol logging to troubleshoot email delivery in your organization.
Read more >
Error 3011 when linking tables with vba code
I tried auto name correction, compact and repair but the error persists. Is there a way to search the entire database to see...
Read more >
asp.net - An attempt to attach an auto-named database for file ...
I had a similar error, but using a connection configured in code, rather than a config file. The solution for me was simply...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found