snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
11.21k stars 3.2k forks source link

Illuminate\Database\Eloquent\ModelNotFoundException : No query results for model [App\Models\User] 1 #10348

Closed ravensgulls closed 2 years ago

ravensgulls commented 3 years ago

Debug mode

Describe the bug

When trying to import assets I get the error stated in title. It only happens after importing users into the database on a fresh snipe install. Seems like its looking for a model that doesn't exist. No assets appear in the the GUI after error happens.

Reproduction steps

  1. Import users into Snipe
  2. Then try to import assets using "sudo php artisan snipeit:import /home/user/Uploads/custom-assets-report-2021-11-22-114733.csv"
  3. Error happens when trying to import ...

Expected behavior

Assets are uploaded and viewable from browser GUI.

Screenshots

Screenshot 2021-11-22 120050

Snipe-IT Version

v5.3.2 build 6508 (g7ce5993f5)

Operating System

Ubuntu

Web Server

Apache

PHP Version

7.4.3

Operating System

Windows

Browser

Chrome

Version

96

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
hash
iconv
imagick
imap
intl
json
ldap
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

Additional context

No response

welcome[bot] commented 3 years ago

👋 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.

uberbrady commented 3 years ago

Is it possible that you're importing stuff that's checked out to locations that don't yet exist? The logic around that piece isn't as sturdy as I'd like.

ravensgulls commented 3 years ago

The locations were created when importing the users. I've checked to make sure they all exist.

uberbrady commented 3 years ago

Hrm. Well, it's blowing up on a findOrFail call, and, importer-wise, I see that only on the ItemImporter where it tries that is on Location. It's also possible that we have some kind of poopy case-sensitivity in there, or something? That'd be a bug on our part if we did, but it's definitely well within the realms of possibility.