-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid data state: accountable records missing for some accounts in self hosted instances #1068
Comments
@jakubkottnauer would you mind running this against your DB to see if this is a stale data issue? select accountable_id, accountable_type from accounts; |
Hello @zachgoll, I have the same issue on my end, I was starting to write an issue and saw this one.
I've executed the query you mentioned
|
@jermorin thanks for providing that. Appears to be a bug since all of the references seem to be intact. I'll take a closer look at this shortly. |
@jakubkottnauer @jermorin just to confirm, you're both on the latest version of Maybe and have migrated the database to the latest schema correct? (DB migrations should happen on container startup) |
@zachgoll Thanks for your answer, I confirm that I'm using the latest version available in the docker registry.
I don't see any error at the container startup select * from schema_migrations order by version desc limit 1 It seems to be the latest migration file
|
@jermorin awesome, very helpful thank you! |
@jermorin would you mind running this updated query so we can see if any of your "accountables" records have accidentally been deleted? I'm able to reproduce this error by manually deleting the "accountable" record for an account, but struggling to see how that could have happened in the first place: SELECT
a.accountable_type,
CASE a.accountable_type
WHEN 'Crypto' THEN cryptos.id
WHEN 'Depository' THEN depositories.id
WHEN 'OtherAsset' THEN other_assets.id
WHEN 'OtherLiability' THEN other_liabilities.id
WHEN 'Investment' THEN investments.id
WHEN 'Property' THEN properties.id
WHEN 'Vehicle' THEN vehicles.id
WHEN 'CreditCard' THEN credit_cards.id
WHEN 'Loan' THEN loans.id
END AS accountable_id
FROM accounts a
LEFT JOIN cryptos ON cryptos.id = a.accountable_id AND a.accountable_type = 'Crypto'
LEFT JOIN depositories ON depositories.id = a.accountable_id AND a.accountable_type = 'Depository'
LEFT JOIN other_assets ON other_assets.id = a.accountable_id AND a.accountable_type = 'OtherAsset'
LEFT JOIN other_liabilities ON other_liabilities.id = a.accountable_id AND a.accountable_type = 'OtherLiability'
LEFT JOIN investments ON investments.id = a.accountable_id AND a.accountable_type = 'Investment'
LEFT JOIN properties ON properties.id = a.accountable_id AND a.accountable_type = 'Property'
LEFT JOIN vehicles ON vehicles.id = a.accountable_id AND a.accountable_type = 'Vehicle'
LEFT JOIN credit_cards ON credit_cards.id = a.accountable_id AND a.accountable_type = 'CreditCard'
LEFT JOIN loans ON loans.id = a.accountable_id AND a.accountable_type = 'Loan'; We're looking for any NULL values in the accountable_id column: |
I'll merge #1071 to avoid the app crash, but leaving this issue open until we identify the root cause. |
Thanks @zachgoll, can confirm the latest Maybe version works again 👍 |
@zachgoll I confirm the latest version works, thanks a lot The result of the query you sent |
@jakubkottnauer @jermorin thanks for confirming! Based on @jermorin's screenshot, it appears that this is a referential integrity issue, which I believe must have happened in a prior state of the app (this shouldn't happen moving forward). What do you both think of the following solution moving forward?
|
@zachgoll I believe your approach is correct; the migration should resolve the issue. Indeed, it's challenging to maintain the evolving state of the app. I've been using Maybe, since it's available in the docker registry. Therefore, it's understandable that occasionally changes might impact its current stability. |
@jermorin yep we're starting to reach a bit of stability now so hopefully the experience continues to improve for self hosting :) |
Describe the bug
I'm getting a 500 error page right after opening Maybe. My Maybe instances auto-updates every night, I believe it started crashing ~2 days ago.
Screenshots / Recordings
Here's a log with that should provide enough info to get to the bottom of this.
The text was updated successfully, but these errors were encountered: