title: Kotlin: Error 503 when loading image from flickr with Picasso
body: <p>My app loads images from flickr using Android's Picasso library. Curiously it was working fine sometime ago after migrating my app to Kotlin, but now I've started to have &quot;random&quot; 503 errors.</p>
  <p>I've set all the permissions in flickr control panel for each image so they're fully public and set security to lowest level to no avail.</p>
  <p>At first I thought lowering security in flickr was the key, but was wrong, because I'm still having this issue. Maybe it is not related to Kotlin migration at all, but I remember it was working fine not so long ago.</p>
  <p>The weird thing is that if I debug and copy the url and paste it in a browser it just loads fine.</p>
  <p>This next is the method where I load the Home Screen image:</p>
  <pre><code>private fun setTodaysThoughtPainting() {
      binding!!.ivTtodaysThought.setOnClickListener { v: View? -&gt; startThoughtActivity(&quot;&quot;) }
      val isTodayThought = AWPreferences.todayThoughtPrefIsToday(this)
      mainPainting = mainViewModel!!.getTodaysPainting(isTodayThought)
      //FLICKR URL EXAMPLE: mainPainting.setUrl(&quot;https://live.staticflickr.com/xxx/xxx_xxx_o_d.jpg&quot;);
      if (mainPainting != null) {
          Picasso.get().load(mainPainting!!.url)
              .transform(RoundedTransformation(cornerRadius, 0))
              .into(binding!!.ivTtodaysThought, object : Callback {
                  override fun onSuccess() {
                      trackId = mainViewModel!!.getTodaysTrack(isTodayThought)
                      mainThought = mainViewModel!!.getTodaysThought(
                          mainPainting,
                          isTodayThought,
                          idLanguage,
                          trackId
                      )
                      if (mainThought != null) {
                          setMainShortenThought(mainThought!!)
                          setMainThoughtDate(Calendar.getInstance())
                          binding!!.ivTtodaysThought.viewTreeObserver.addOnGlobalLayoutListener(
                              object : OnGlobalLayoutListener {
                                  override fun onGlobalLayout() {
                                      binding!!.ivTtodaysThought.viewTreeObserver.removeOnGlobalLayoutListener(
                                          this
                                      )
                                      val realImgSize = ImageHelper.getRealImageSize(
                                          binding!!.ivTtodaysThought
                                      )
                                      setThoughtMargin(realImgSize[0])
                                  }
                              })
                      }
                  }
  
                  override fun onError(e: Exception) {
                      e.printStackTrace()
                  }
              })
      }
  }
  </code></pre>
  <p>Any help?</p>
  <p>Edit 1:</p>
  <p>This is the Picasso stack trace:</p>
  <pre><code>2022-06-15 23:59:03.231 32258-32258/com.xxx.xxx W/System.err: com.squareup.picasso.NetworkRequestHandler$ResponseException: HTTP 503
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at com.squareup.picasso.NetworkRequestHandler.load(NetworkRequestHandler.java:51)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:219)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:175)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at java.lang.Thread.run(Thread.java:929)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:354)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err: com.squareup.picasso.NetworkRequestHandler$ResponseException: HTTP 503
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at com.squareup.picasso.NetworkRequestHandler.load(NetworkRequestHandler.java:51)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:219)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:175)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at java.lang.Thread.run(Thread.java:929)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:354)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err: com.squareup.picasso.NetworkRequestHandler$ResponseException: HTTP 503
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at com.squareup.picasso.NetworkRequestHandler.load(NetworkRequestHandler.java:51)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:219)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:175)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
  2022-06-15 23:59:03.232 32258-32258/com.xxx.xxx W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
  2022-06-15 23:59:03.233 32258-32258/com.xxx.xxx W/System.err:     at java.lang.Thread.run(Thread.java:929)
  2022-06-15 23:59:03.233 32258-32258/com.xxx.xxx W/System.err:     at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:354)
  2022-06-15 23:59:03.282 32258-32258/com.xxx.xxx W/System.err: com.squareup.picasso.NetworkRequestHandler$ResponseException: HTTP 503
  2022-06-15 23:59:03.282 32258-32258/com.xxx.xxx W/System.err:     at com.squareup.picasso.NetworkRequestHandler.load(NetworkRequestHandler.java:51)
  2022-06-15 23:59:03.283 32258-32258/com.xxx.xxx W/System.err:     at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:219)
  2022-06-15 23:59:03.283 32258-32258/com.xxx.xxx W/System.err:     at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:175)
  2022-06-15 23:59:03.283 32258-32258/com.xxx.xxx W/System.err:     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
  2022-06-15 23:59:03.283 32258-32258/com.xxx.xxx W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  2022-06-15 23:59:03.283 32258-32258/com.xxx.xxx W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
  2022-06-15 23:59:03.283 32258-32258/com.xxx.xxx W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
  2022-06-15 23:59:03.283 32258-32258/com.xxx.xxx W/System.err:     at java.lang.Thread.run(Thread.java:929)
  2022-06-15 23:59:03.283 32258-32258/com.xxx.xxx W/System.err:     at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:354)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/UwCgI.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UwCgI.jpg" alt="enter image description here" /></a></p>
  <p>Edit 1:</p>
  <p>After struggling my head for months I finally found that this issue has nothing to do with Picasso.</p>
  <p>I store my images in Flickr, and my conclusion is Flickr team have probably made changes (like security changes or whatever) because I tried with a different domain test image, in concrete <a href="https://lh6.ggpht.com/9SZhHdv4URtBzRmXpnWxZcYhkgTQurFuuQ8OR7WZ3R7fyTmha77dYkVvcuqMu3DLvMQ=w300" rel="nofollow noreferrer">this</a> and its working. I've written Flickr support with no response yet.</p>
  <p>I'm still stuck with this.</p>
  <p>Edit 2:</p>
  <p>It doesn't make any sense, but there are images that work and images that doesn't, when the configuration of each image is the same.</p>
  <p>More stuck than ever :)</p>