Error importing since stryd ConnectIQ
Opened this issue · 8 comments
Hello,
I don't know if it is related, but since around the time I'm using a Styd foot pod I cannot import the fit files anymore. Older files work well. The device recorded the fit file is a Fenix 6x and has the Stryd data field active.
It errors with the following:
postrunner import 7145928273_ACTIVITY.fit
ERROR: undefined method `fit_file_name' for "@timestamp":String
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner/FFS_Device.rb:130:in `block in activity_by_file_name'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/perobs-4.3.0/lib/perobs/Array.rb:71:in `each'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/perobs-4.3.0/lib/perobs/Array.rb:71:in `find'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/perobs-4.3.0/lib/perobs/Array.rb:71:in `block (2 levels) in <class:Array>'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/perobs-4.3.0/lib/perobs/ObjectBase.rb:57:in `method_missing'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner/FFS_Device.rb:130:in `activity_by_file_name'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner/FFS_Device.rb:56:in `add_fit_file'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/perobs-4.3.0/lib/perobs/ObjectBase.rb:57:in `method_missing'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner/FitFileStore.rb:156:in `add_fit_file'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/perobs-4.3.0/lib/perobs/ObjectBase.rb:57:in `method_missing'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner/Main.rb:492:in `import_fit_file'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner/Main.rb:466:in `process_file'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner/Main.rb:451:in `block in process_files'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner/Main.rb:445:in `each'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner/Main.rb:445:in `process_files'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner/Main.rb:349:in `execute_command'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner/Main.rb:79:in `main'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner.rb:24:in `<module:PostRunner>'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner.rb:22:in `<top (required)>'
<internal:/usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
<internal:/usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/bin/postrunner:4:in `<top (required)>'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/bin/postrunner:23:in `load'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/bin/postrunner:23:in `<main>'
*******************************************************************************
You have triggered a bug in PostRunner 1.0.4!
I don't think this is related to the Stryd. I'm also using a Fenix 6X and a Stryd without issues. Are you using fit4ruby version 3.8.0? Please make sure it doesn't accidentally pick up an older version. If that doesn't help, I'm happy to debug this further, but I would likely require the FIT file for that. If you don't mind sharing it, please email it to chris linux com.
To be complete, the dependency list. It seems to pick up the right version.
The fit file is on its way.
*** LOCAL GEMS ***
abbrev (default: 0.1.0)
base64 (default: 0.1.0)
benchmark (default: 0.1.1)
bigdecimal (3.0.2, default: 3.0.0)
bindata (2.4.10, 2.4.8)
bundler (2.2.24, default: 2.2.22)
cgi (default: 0.2.0)
csv (3.2.0, default: 3.1.9)
date (3.1.1, default: 3.1.0)
dbm (default: 1.1.0)
debug (0.2.0, default: 0.1.0)
delegate (default: 0.2.0)
did_you_mean (default: 1.5.0)
digest (default: 3.0.0)
drb (default: 2.0.4)
english (default: 0.7.1)
erb (2.2.3, default: 2.2.0)
etc (default: 1.2.0)
fcntl (default: 1.0.0)
fiddle (1.0.9, default: 1.0.6)
fileutils (default: 1.5.0)
find (default: 0.1.0)
fit4ruby (3.8.0)
forwardable (default: 1.3.2)
getoptlong (default: 0.1.1)
io-console (0.5.9, default: 0.5.7)
io-nonblock (default: 0.1.0)
io-wait (default: 0.1.0)
ipaddr (default: 1.2.2)
irb (1.3.6, default: 1.3.5)
json (default: 2.5.1)
logger (default: 1.4.3)
matrix (0.4.2, default: 0.3.1)
mini_portile2 (2.6.1, 2.4.0)
minitest (5.14.4, 5.14.2)
mutex_m (default: 0.1.1)
net-ftp (0.1.3, default: 0.1.2)
net-http (default: 0.1.1)
net-imap (0.2.2, default: 0.1.1)
net-pop (default: 0.1.1)
net-protocol (0.1.1, default: 0.1.0)
net-smtp (default: 0.2.1)
nkf (default: 0.1.0)
nokogiri (1.11.7 x86_64-darwin, 1.10.10)
observer (default: 0.1.1)
open-uri (default: 0.1.0)
open3 (default: 0.1.1)
openssl (default: 2.2.0)
optparse (0.1.1, default: 0.1.0)
ostruct (0.4.0, default: 0.3.1)
pathname (default: 0.1.0)
perobs (4.3.0)
postrunner (1.0.4)
power_assert (2.0.0, 1.2.0)
pp (0.2.0, default: 0.1.0)
prettyprint (default: 0.1.0)
prime (default: 0.1.2)
pstore (default: 0.1.1)
psych (4.0.1, default: 3.3.0)
racc (1.5.2, default: 1.5.1)
rake (13.0.6, 13.0.3)
rbs (1.2.1, 1.0.4)
rdoc (6.3.2, default: 6.3.1)
readline (default: 0.0.2)
readline-ext (0.1.2, default: 0.1.1)
reline (0.2.6, default: 0.2.5)
resolv (0.2.1, default: 0.2.0)
resolv-replace (default: 0.1.0)
rexml (3.2.5)
rinda (default: 0.1.0)
rss (0.2.9)
securerandom (default: 0.1.0)
set (default: 1.0.1)
shellwords (default: 0.1.0)
singleton (default: 0.1.1)
stringio (default: 3.0.0)
strscan (default: 3.0.0)
syslog (default: 0.1.0)
tempfile (default: 0.1.1)
test-unit (3.4.4, 3.3.7)
time (default: 0.1.0)
timeout (default: 0.1.1)
tmpdir (default: 0.1.2)
tracer (default: 0.1.1)
tsort (default: 0.1.0)
typeprof (0.14.1, 0.12.0)
un (default: 0.1.0)
uri (default: 0.10.1)
weakref (default: 0.1.1)
yaml (default: 0.1.1)
zlib (default: 1.1.0)
Your FIT file does import without issues here. I think you postrunner database may be corrupted. Can you please
- Create a backup of your ~/.postrunner directory and
- Run 'postrunner check'
It will check you database and all imported FIT files. This will take some time depending on the number of FIT files you have already imported. If the database is corrupted, it will print a hopefully helpful message.
I ran postrunner check
but it sounds the same as the import error:
Re-indexing blobs file [0:00:00]
Checking object link structure [0:00:00]
ERROR: undefined method `timestamp' for "@timestamp":String
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner/FitFileStore.rb:276:in `block in activities'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner/FitFileStore.rb:275:in `sort!'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner/FitFileStore.rb:275:in `activities'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner/FitFileStore.rb:377:in `check'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/perobs-4.3.0/lib/perobs/ObjectBase.rb:57:in `method_missing'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner/Main.rb:317:in `execute_command'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner/Main.rb:79:in `main'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner.rb:24:in `<module:PostRunner>'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/lib/postrunner.rb:22:in `<top (required)>'
<internal:/usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
<internal:/usr/local/Cellar/ruby/3.0.2/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/gems/postrunner-1.0.4/bin/postrunner:4:in `<top (required)>'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/bin/postrunner:23:in `load'
/Users/tobias.breitwieser/.gem/ruby/3.0.0/bin/postrunner:23:in `<main>'
*******************************************************************************
You have triggered a bug in PostRunner 1.0.4!
OK, so the structure of your database is still correct. Looks like at least one activity has a corrupted timestamp. For some reason the value is the string '@timestamp' instead of the actual ruby Time value. Could be due to a bug but I could not find such a piece of code.
The check seems to have run really fast. Do you have many runs in your postrunner database? If not, we could just recreate it. The original FIT files are in the directories under ~/.postrunner/devices. You could move the database away and just re-import them all. But that will lose any manually set attributes like names. If that's not an option for you, we could try to find the broken activity and just remove it from the database.
I right now try to find the fit file which maybe create this issue.
I have around 850 activities dating back a few years.
find ./ -name '*.fit' -exec echo {} \; -and -exec sh -c 'postrunner import {} > ~/tmp/postrunner/{}.log' \; -and -exec grep -c "You have triggered a bug in PostRunner 1.0.4" ~/tmp/postrunner/{}.log \; -or -exec rm ~/tmp/postrunner/{}.log \;
This should tell me which ones fail to import, and then working through them should give me more clues.
By the way, it would be helpful if import would exit with 1
if an error happened and not with 0
. That's the reason why I look for the logs and not directly into the return of postrunner.
Good suggestion! I've added proper exit codes for most error conditions.
Right now, I can just not reproduce this bug reliably. If I import my around 800 activities with the method above, random ones fail with some being consistent but nothing really to pin it.