{"action":"closed","issue":{"url":"https://api.github.com/repos/killrweather/killrweather/issues/4","labels_url":"https://api.github.com/repos/killrweather/killrweather/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/killrweather/killrweather/issues/4/comments","events_url":"https://api.github.com/repos/killrweather/killrweather/issues/4/events","html_url":"https://github.com/killrweather/killrweather/issues/4","id":56110420,"number":4,"title":"Exception thrown when sample no longer has any un-queried data","user":{"login":"searler","id":220239,"avatar_url":"https://avatars.githubusercontent.com/u/220239?v=3","gravatar_id":"","url":"https://api.github.com/users/searler","html_url":"https://github.com/searler","followers_url":"https://api.github.com/users/searler/followers","following_url":"https://api.github.com/users/searler/following{/other_user}","gists_url":"https://api.github.com/users/searler/gists{/gist_id}","starred_url":"https://api.github.com/users/searler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/searler/subscriptions","organizations_url":"https://api.github.com/users/searler/orgs","repos_url":"https://api.github.com/users/searler/repos","events_url":"https://api.github.com/users/searler/events{/privacy}","received_events_url":"https://api.github.com/users/searler/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-31T03:22:02Z","updated_at":"2015-03-13T13:12:41Z","closed_at":"2015-03-13T13:12:41Z","body":"```\r\n[ERROR] [2015-01-30 21:04:58,616] [akka.actor.OneForOneStrategy]: next on empty iterator\r\njava.util.NoSuchElementException: next on empty iterator\r\n        at scala.collection.Iterator$$anon$2.next(Iterator.scala:39) ~[scala-library.jar:0.13.5]\r\n        at scala.collection.Iterator$$anon$2.next(Iterator.scala:37) ~[scala-library.jar:0.13.5]\r\n        at scala.collection.IterableLike$class.head(IterableLike.scala:91) ~[scala-library.jar:0.13.5]\r\n        at scala.collection.AbstractIterable.head(Iterable.scala:54) ~[scala-library.jar:0.13.5]\r\n        at com.datastax.killrweather.WeatherApiQueries.queries(KillrWeatherClientApp.scala:77) ~[classes/:na]\r\n        at com.datastax.killrweather.WeatherApiQueries$$anonfun$receive$1.applyOrElse(KillrWeatherClientApp.scala:61) ~[classes/:na]\r\n        at akka.actor.Actor$class.aroundReceive(Actor.scala:465) ~[akka-actor_2.10-2.3.8.jar:na]\r\n        at com.datastax.killrweather.WeatherApiQueries.aroundReceive(KillrWeatherClientApp.scala:37) ~[classes/:na]\r\n        at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516) [akka-actor_2.10-2.3.8.jar:na]\r\n        at akka.actor.ActorCell.invoke(ActorCell.scala:487) [akka-actor_2.10-2.3.8.jar:na]\r\n        at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:254) [akka-actor_2.10-2.3.8.jar:na]\r\n        at akka.dispatch.Mailbox.run(Mailbox.scala:221) [akka-actor_2.10-2.3.8.jar:na]\r\n        at akka.dispatch.Mailbox.exec(Mailbox.scala:231) [akka-actor_2.10-2.3.8.jar:na]\r\n        at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [scala-library.jar:na]\r\n        at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [scala-library.jar:na]\r\n        at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [scala-library.jar:na]\r\n        at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [scala-library.jar:na]\r\n```\r\n\r\nWhich is generated from\r\n```\r\nval sample: Day = fileFeed().flatMap { case f =>\r\n      val source = FileSource(f).source\r\n      val s = source.getLines().map(Day(_)).filterNot(previous).toSeq.headOption\r\n      Try(source.close())\r\n      s\r\n    }.head\r\n```\r\n\r\nThe final ```head``` will fail if all the data has been previously queried. "}}