I've got several ledger files: some I use regularly and others not so much. I've just started touching one of those and found problems, and I'm wondering if there's an easy way to find out where the problem exists and how to fix it. I realize it may be impossible, unless I were willing to take the time to sanitize the data first. I also realize that a good file recovery might help, but I think I found the same problem in recent backups, and so I might be into a binary search to find out the last good file, assuming there is one.
If I run ledger --sort d reg ^Expenses I get 12 complaints. The first, lightly edited for privacy, says, While parsing file "FQFN", line 339: While parsing transaction: > 2006/09/31 * Credit Dividend Error: Day of month is not valid for year Ledger is correct: that is indeed what the file says. There are two entries like that; the other one is for 2007/09/31, and it is on the same account but later in the file. The next says, While parsing file "FQFN", line 401: While balancing transaction from "FQFN", lines 399-401: > 2006/12/19 * Account Payee > Assets:Account:Name 2.054 AssetSymbol > Income:Another:Account:Name $36.23 Unbalanced remainder is: $72.46 Amount to balance against: $72.46 Error: Transaction does not balance There are 8 entries like that, covering entries in about 30 lines of the ~2,500 line file. In each case, the structure is the same: the unbalanced remainder is always twice the income, and the amount it is to balance against always looks the same. There are two unique errors. The first is While parsing file "FQFN", line 986: Error: Posting with null amount's account may be misspelled: "Assets:Current Assets:Savings:Name Of The Financial Institution $123.45" That entry exists. That happened because there is one space before the $ and not two; when I added the space in, the error went away. That entry was dated 2008, and I can't imagine having touched that entry in years. Finally, I get While parsing file "FQFN", line 2970: While parsing posting: Assets:Account:Name $0.11=\ ^ Error: Backslash at end of commodity name I find exactly 1 entry with an amount of $0.11. There is no visible character after the second "1". Hexl-mode shows these bytes: 2430 2e31 310a 2020 2020 496e Looking at nearby entries, I always find the 0a20202020 pattern between the last digit and the next entry. Those errors seem strange to me: - Why did I get two errors about dates with the same month/day combination on the same account? Is that just an interesting coincidence? - I don't understand the complaints about the transactions not matching; that used to work, and the visible amounts that don't balance seem equal. - Where did the "=\" come from? I can think of two possible reasons: - I did get SMART errors last summer, and I then replaced the drive. Perhaps there were real errors, but the regularity seems strange to have been caused by a failing disk. - I may not have run ledger on this file since upgrading from 2.6 to 3.1.0 when I upgraded from Debian Wheezy to Jessie. I can see that causing problems in reporting, but all but the last error happened to quite old data, so it's unlikely I was even working in those parts of the file, and I don't think ledger or ledger-mode write to the file in these ways. I suspect there are other possible reasons, too. My questions: 1. Has anyone seen anything like this? Does it make any sense? 2. Is there an obvious command sequence in ledger 3.1.0 that would find any other errors, or did this likely get everything it can recognize? 3. Is there something obvious I can do to fix the transactions that do not balance or the "=/"? With only 11 errors, it sounds nicer to fix those than to restore from the past and then add more recent transactions. Thanks, Bill PS: I like the new ledger-mode. -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.