-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'assets.' in 'where clause' #10702
Comments
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. |
If you look at But I bet if you run The only other thing that seems like it's variable based on which asset you're looking at is "Currency" - which would differ based on what location the asset was currently at, I suppose? If you go into Settings, Localization, and set a default currency - does the problem go away? |
@uberbrady Thank you for the response! Here is the output of the php artisan tinker. I should also have included that the API returns the asset info without error and that I am creating assets via the API:
From laravel.log: [previous exception] [object] (PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'assets.' in 'where clause' at /var/www/html/snipeit/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:79) |
How did you upgrade? |
@yosiasz From the command line with php upgrade.php which finished without errors. |
Using the rest api, or snipeit UI which hardware is id = 1125 . That asset has something off in the data. Missing a required column? Not sure how if the query is created dynamically but there is a missing column in that query that is erroring out. |
@inietov I thought we fixed this issue - can you take a look today? @palmeraeasd You said "Unsure, I have run upgrade.php so I assume the latest?" - "latest" can mean anything at any given time. Always make sure to look in the footer of your Snipe-IT, or in your Admin Settings for the precise version and hash. |
No, that's not it - we do some complicated joins in those queries. |
@snipe Sorry, I didn't know where to check for that info. Info from the admin settings page: Thank you for helping with this. |
Can you tell me what's on line 228 of |
@snipe
|
This is usually a data problem. It means that there is no record for what type of entity the asset was checked out to, so it doesn't know what table to query. I'd bet if you queried the |
It's saying asset_logs is empty: MariaDB [snipeit]> select * from asset_logs; |
Apologies, I meant |
assigned_type is NULL for asset 1125 from the assets table target_type is NULL for both entries for this asset in the action_logs table with "create" and "update" actions_types |
But there is an Create and update wouldn't warrant a |
No, the asset is unassigned. The assigned_to value is NULL |
Huh. What about |
NULL for both entries |
assets
where assets
.`` = 1125 limit 1) (View: /var/www/html/snipeit/resources/views/hardware/view.blade.php)
That's... very curious. Those are the only two places where I can remember us using dynamic pivots (the Does this only happen on 1125, or on other assets as well? How did the asset get into the system? API, GUI, CSV import, etc? |
Also, if you change line 822 of
to
does that fix the error? |
It happens on more than one asset. I have only found two from just clicking around. I made the change in view.blade.php but it does not change the error. Here is how I add assets via the API in a bash script:
$USER_ID is blank if it is unassigned |
I'll probably just wipe the server and start over |
Issue was related to using assigned_to in the patch (https://snipe-it.readme.io/reference/hardware-partial-update) function instead of checking in (https://snipe-it.readme.io/reference/hardware-checkin) and checking out (https://snipe-it.readme.io/reference/hardware-checkout) assets. |
Debug mode
Describe the bug
When viewing certain assets server error 500 happens. Enabling debug results in:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'assets.' in 'where clause' (SQL: select * from
assets
whereassets
.`` = 1125 limit 1) (View: /var/www/html/snipeit/resources/views/hardware/view.blade.php)Reproduction steps
...
Expected behavior
The asset view page will come up
Screenshots
No response
Snipe-IT Version
Unsure, I have run upgrade.php so I assume the latest?
Operating System
Ubuntu
Web Server
Apache
PHP Version
7.4.3
Operating System
MacOS
Browser
Chrome
Version
98
Device
No response
Operating System
No response
Browser
No response
Version
No response
Error messages
Additional context
Happened before and after upgrade
I have not manually edited the database
I have ran the commands on common issues page
The text was updated successfully, but these errors were encountered: