sourcegraph/thyme

Index out-of-bounds error during html generation

holstvoogd opened this issue · 4 comments

I've been running thyme all day and tried to generate the html report, but got an error:

[17:24:26] ~ $ thyme show -i thyme.json -w stats > thyme.html
panic: runtime error: index out of range

goroutine 1 [running]:
panic(0x1f4ee0, 0xc820012090)
    /usr/local/Cellar/go/1.6.3/libexec/src/runtime/panic.go:481 +0x3e6
github.com/sourcegraph/thyme.(*Window).Info(0xc820365920, 0xc8201e9920)
    /Users/arthur/Projects/go/src/github.com/sourcegraph/thyme/data.go:130 +0x2bc
github.com/sourcegraph/thyme.appID(0xc820365920, 0x0, 0x0)
    /Users/arthur/Projects/go/src/github.com/sourcegraph/thyme/show.go:381 +0x42
github.com/sourcegraph/thyme.NewTimeline(0xc8200b6740, 0x297bc8, 0xc8203e8e40)
    /Users/arthur/Projects/go/src/github.com/sourcegraph/thyme/show.go:177 +0x983
github.com/sourcegraph/thyme.Stats(0xc8200b6740, 0x0, 0x0)
    /Users/arthur/Projects/go/src/github.com/sourcegraph/thyme/show.go:18 +0x6d
main.(*ShowCmd).Execute(0x355e20, 0xc8200aea50, 0x0, 0x5, 0x0, 0x0)
    /Users/arthur/Projects/go/src/github.com/sourcegraph/thyme/cmd/thyme/main.go:114 +0x59e
github.com/jessevdk/go-flags.(*Parser).ParseArgs(0xc8200c8000, 0xc82000a0d0, 0x5, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0)
    /Users/arthur/Projects/go/src/github.com/jessevdk/go-flags/parser.go:314 +0xa83
github.com/jessevdk/go-flags.(*Parser).Parse(0xc8200c8000, 0x0, 0x0, 0x0, 0x0, 0x0)
    /Users/arthur/Projects/go/src/github.com/jessevdk/go-flags/parser.go:185 +0x9b
main.main.func1(0x0, 0x0)
    /Users/arthur/Projects/go/src/github.com/sourcegraph/thyme/cmd/thyme/main.go:141 +0x2f
main.main()
    /Users/arthur/Projects/go/src/github.com/sourcegraph/thyme/cmd/thyme/main.go:148 +0x23

Looks like the expected tab name does not exist in OSX when 0 windows for chrome are open.

 {
      "Time": "2016-08-17T12:58:49.785943542-05:00",
      "Windows": [
        {
          "ID": 1798583,
          "Name": "Finder"
        },
        {
          "ID": 55178396,
          "Name": "iTerm2"
        },
        {
          "ID": 56296877,
          "Name": "idea"
        },
        {
          "ID": 60672473,
          "Name": "Activity Monitor"
        },
        {
          "ID": 61508261,
          "Name": "Google Chrome"
        },
        {
          "ID": 61827827,
          "Name": "Slack"
        }
      ],
      "Active": 55178396,
      "Visible": [
        55178396,
        55178396,
        55178396,
        56296877,
        61827827
      ]
    }

once I applied the above patch I was able to generate the HTML

The patch referenced above appears to have worked for issues related to Chrome, but I am still seeing the same issue after running multiple other apps and attempting to generate html with thyme show -i thyme.json -w stats > thyme.html

The error I get is:
panic: runtime error: index out of range

Similar problem same command. I assume that running go get -u github.com/sourcegraph/thyme/cmd/thyme should get me the new one but if there is something else I need to do to apply the patch that would be great.
panic: runtime error: index out of range

goroutine 1 [running]:
panic(0x17f600, 0xc4200100c0)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/sourcegraph/thyme.(_Window).Info(0xc42000f7e0, 0xc4203840c0)
/Users/admin/work/src/github.com/sourcegraph/thyme/data.go:130 +0x4be
github.com/sourcegraph/thyme.appID(0xc42000f7e0, 0xc4203b4e40, 0xc42046f818)
/Users/admin/work/src/github.com/sourcegraph/thyme/show.go:381 +0x2f
github.com/sourcegraph/thyme.NewTimeline(0xc42000e9c0, 0x1c1c30, 0xc4200b1540)
/Users/admin/work/src/github.com/sourcegraph/thyme/show.go:177 +0xb1a
github.com/sourcegraph/thyme.Stats(0xc42000e9c0, 0x5, 0x1aa813)
/Users/admin/work/src/github.com/sourcegraph/thyme/show.go:18 +0x5f
main.(_ShowCmd).Execute(0x278180, 0xc420014910, 0x0, 0x5, 0x0, 0x0)
/Users/admin/work/src/github.com/sourcegraph/thyme/cmd/thyme/main.go:114 +0x44b
github.com/jessevdk/go-flags.(_Parser).ParseArgs(0xc42000a360, 0xc42000a0d0, 0x5, 0x5, 0x1, 0x0, 0x1b3201, 0xc4200001a0, 0x0)
/Users/admin/work/src/github.com/jessevdk/go-flags/parser.go:314 +0x8e6
github.com/jessevdk/go-flags.(_Parser).Parse(0xc42000a360, 0x0, 0x0, 0x0, 0x0, 0x0)
/Users/admin/work/src/github.com/jessevdk/go-flags/parser.go:185 +0x74
main.main.func1(0x0, 0x32c4)
/Users/admin/work/src/github.com/sourcegraph/thyme/cmd/thyme/main.go:141 +0x2d
main.main()
/Users/admin/work/src/github.com/sourcegraph/thyme/cmd/thyme/main.go:148 +0x31