Error Code Guide
Error Code Guide
This guide provides comprehensive explanations and solutions for common error codes encountered in Zhang Accounting. Understanding these error codes will help you troubleshoot and resolve issues more efficiently.
UnbalancedTransaction
This error indicates that a transaction is unbalanced, meaning the sum of each posting does not equal zero. This is often due to discrepancies in the amounts or currencies used in the postings.
Example of Unbalanced Transaction:
Solution: Ensure all postings within a transaction balance out, using the same currency or properly converting between currencies.
TransactionCannotInferTradeAmount
Occurs when Zhang Accounting cannot infer the trade amount for a transaction. This can happen if postings lack explicit amounts or if the transaction’s context does not allow for an amount to be inferred.
Example of Error:
Correct Case:
Solution: Make sure to specify amounts for all postings in a transaction or ensure the transaction’s context allows for an amount to be inferred.
TransactionHasMultipleImplicitPosting
Zhang Accounting, similar to Beancount, allows only one implicit posting per transaction to ensure clarity and prevent ambiguity.
Example of Error:
Solution: Ensure only one posting in a transaction lacks an explicit amount.
TransactionExplicitPostingHaveMultipleCommodity
This error is triggered when a transaction has postings with multiple non-zero commodity amounts, making it impossible to infer amounts for implicit postings.
Example of Error:
Solution: Review and adjust the transaction to ensure only one commodity is involved or all postings have explicit amounts.
AccountBalanceCheckError
Indicates a failure in an account’s balance check, possibly due to incorrect balance entries or transactions affecting the account.
Example of Error:
Correct Case:
Solution: Verify and correct all transactions affecting the account to ensure the balance check aligns with the actual account balance.
AccountDoesNotExist
Triggered when operations are performed on an account that has not been defined in the ledger.
Example of Error:
Correct Case:
Solution: Define the account using the open
directive before referencing it in transactions or other operations.
AccountClosed
Occurs when attempting to perform operations on a closed account. Ensure the account is open or reopen it before performing transactions.
Example of Error:
Correct Case:
Solution: Reopen the account using the open
directive if necessary before conducting transactions.
CommodityDoesNotDefine
This error occurs when a commodity used in a transaction or directive is not defined in the ledger.
Example of Error:
Correct Case:
Solution: Define the commodity using the commodity
directive before using it in transactions or other directives.
NoEnoughCommodityLot
Indicates there’s not enough commodity lot available for a transaction. This can happen when selling or transferring more of a commodity than is available.
Example of Error:
Correct Case:
Solution: Ensure the commodity lots are sufficient for the transaction or adjust the transaction to match the available lots.
CloseNonZeroAccount
Triggered when attempting to close an account with a non-zero balance. Accounts must have a zero balance before they can be closed.
Example of Error:
Correct Case:
Solution: Balance the account to zero before attempting to close it.
BudgetDoesNotExist
Occurs when referencing a budget that has not been defined. Ensure the budget is defined before referencing it in transactions or directives.
Example of Error:
Correct Case:
Solution: Define the budget using the budget
directive before adding funds or performing other operations.
DefineDuplicatedBudget
This error occurs when a budget is defined more than once, which can lead to confusion and errors in budget tracking.
Example of Error:
Correct Case:
Solution: Ensure each budget is uniquely defined and avoid duplicating budget definitions.
MultipleOperatingCurrencyDetect
Triggered when multiple operating currencies are detected in the ledger. Zhang Accounting requires a single operating currency to be defined.
Example of Error:
Correct Case:
Solution: Define only one operating currency in the ledger options.
ParseInvalidMeta
Occurs when parsing invalid metadata in directives, which can lead to errors in processing and interpretation.
Example of Error:
Correct Case:
Solution: Ensure metadata is correctly formatted and valid for the context in which it is used.