Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug report: ERROR: while parsing a block mapping at line 9, column 8: expected <block end>, but found YAML.ScalarToken at line 9, column 18 #11

Closed
DilumAluthge opened this issue Dec 8, 2020 · 6 comments · Fixed by #13

Comments

@DilumAluthge
Copy link
Member

MWE:

julia> import BrokenRecord

julia> import GitHub

julia> import HTTP

julia> dir = mktempdir();

julia> cd(dir)

julia> BrokenRecord.configure!(; path=dir)

julia> BrokenRecord.playback(() -> GitHub.repo("JuliaLang/julia"), "test.yml");

julia> BrokenRecord.playback(() -> GitHub.repo("JuliaLang/julia"), "test.yml");
ERROR: while parsing a block mapping at line 9, column 8: expected <block end>, but found YAML.ScalarToken at line 9, column 18
Stacktrace:
 [1] parse_block_mapping_key(::YAML.EventStream) at /Users/dilum/.julia/packages/YAML/aMmWk/src/parser.jl:434
 [2] peek(::YAML.EventStream) at /Users/dilum/.julia/packages/YAML/aMmWk/src/parser.jl:54
 [3] _compose_mapping_node(::YAML.MappingStartEvent, ::YAML.Composer, ::Nothing) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:174
 [4] compose_mapping_node(::YAML.Composer, ::Nothing) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:184
 [5] handle_event(::YAML.MappingStartEvent, ::YAML.Composer) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:86
 [6] compose_node(::YAML.Composer) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:94
 [7] __compose_sequence_node(::YAML.MappingStartEvent, ::YAML.Composer, ::YAML.SequenceNode) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:120
 [8] _compose_sequence_node(::YAML.SequenceStartEvent, ::YAML.Composer, ::Nothing) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:139
 [9] compose_sequence_node(::YAML.Composer, ::Nothing) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:148
 [10] handle_event(::YAML.SequenceStartEvent, ::YAML.Composer) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:80
 [11] compose_node(::YAML.Composer) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:94
 [12] __compose_mapping_node(::YAML.ScalarEvent, ::YAML.Composer, ::YAML.MappingNode) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:155
 [13] _compose_mapping_node(::YAML.MappingStartEvent, ::YAML.Composer, ::Nothing) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:175
 [14] compose_mapping_node(::YAML.Composer, ::Nothing) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:184
 [15] handle_event(::YAML.MappingStartEvent, ::YAML.Composer) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:86
 [16] compose_node(::YAML.Composer) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:94
 [17] __compose_sequence_node(::YAML.MappingStartEvent, ::YAML.Composer, ::YAML.SequenceNode) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:120
 [18] _compose_sequence_node(::YAML.SequenceStartEvent, ::YAML.Composer, ::Nothing) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:139
 [19] compose_sequence_node(::YAML.Composer, ::Nothing) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:148
 [20] handle_event(::YAML.SequenceStartEvent, ::YAML.Composer) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:80
 [21] compose_node(::YAML.Composer) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:94
 [22] __compose_mapping_node(::YAML.ScalarEvent, ::YAML.Composer, ::YAML.MappingNode) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:155
 [23] _compose_mapping_node(::YAML.MappingStartEvent, ::YAML.Composer, ::Nothing) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:175
 [24] compose_mapping_node(::YAML.Composer, ::Nothing) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:184
 [25] handle_event(::YAML.MappingStartEvent, ::YAML.Composer) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:86
 [26] compose_node(::YAML.Composer) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:94
 [27] compose_document(::YAML.Composer) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:50
 [28] compose(::YAML.EventStream) at /Users/dilum/.julia/packages/YAML/aMmWk/src/composer.jl:38
 [29] load(::YAML.TokenStream, ::Nothing; dicttype::Type{Dict{Any,Any}}) at /Users/dilum/.julia/packages/YAML/aMmWk/src/YAML.jl:22
 [30] load at /Users/dilum/.julia/packages/YAML/aMmWk/src/YAML.jl:22 [inlined]
 [31] #load#10 at /Users/dilum/.julia/packages/YAML/aMmWk/src/YAML.jl:40 [inlined]
 [32] load at /Users/dilum/.julia/packages/YAML/aMmWk/src/YAML.jl:40 [inlined]
 [33] #17 at /Users/dilum/.julia/packages/YAML/aMmWk/src/YAML.jl:87 [inlined]
 [34] open(::YAML.var"#17#18"{Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},Nothing}, ::String, ::Vararg{String,N} where N; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at ./io.jl:325
 [35] open at ./io.jl:323 [inlined]
 [36] #load_file#16 at /Users/dilum/.julia/packages/YAML/aMmWk/src/YAML.jl:85 [inlined]
 [37] load_file at /Users/dilum/.julia/packages/YAML/aMmWk/src/YAML.jl:85 [inlined] (repeats 2 times)
 [38] load(::Type{BrokenRecord.YAMLStorage}, ::String) at /Users/dilum/.julia/packages/BrokenRecord/1lvdc/src/storage.jl:85
 [39] before(::Type{BrokenRecord.PlaybackLayer}, ::Type{T} where T, ::String) at /Users/dilum/.julia/packages/BrokenRecord/1lvdc/src/playback.jl:6
 [40] playback(::var"#3#4", ::String; ignore_headers::Array{Any,1}, ignore_query::Array{Any,1}) at /Users/dilum/.julia/packages/BrokenRecord/1lvdc/src/BrokenRecord.jl:87
 [41] playback(::Function, ::String) at /Users/dilum/.julia/packages/BrokenRecord/1lvdc/src/BrokenRecord.jl:73
 [42] top-level scope at REPL[7]:1

Version info:

julia> versioninfo()
Julia Version 1.5.3
Commit 788b2c77c1* (2020-11-09 13:37 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin19.6.0)
  CPU: Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, haswell)

Project:

(@v1.5) pkg> st
Status `~/.julia/environments/v1.5/Project.toml`
  [bdd55f5b] BrokenRecord v0.1.4
  [bc5e4493] GitHub v5.2.0
  [cd3eb016] HTTP v0.9.1

Manifest:

(@v1.5) pkg> st -m
Status `~/.julia/environments/v1.5/Manifest.toml`
  [56f22d72] Artifacts v1.3.0
  [fbb218c0] BSON v0.2.6
  [bdd55f5b] BrokenRecord v0.1.4
  [944b1d66] CodecZlib v0.7.0
  [34da2185] Compat v3.23.0
  [864edb3b] DataStructures v0.18.8
  [e2ba6199] ExprTools v0.1.3
  [8f5d6c58] EzXML v1.1.0
  [48062228] FilePathsBase v0.9.6
  [bc5e4493] GitHub v5.2.0
  [cd3eb016] HTTP v0.9.1
  [83e8ac13] IniFile v0.5.0
  [033835bb] JLD2 v0.3.1
  [692b3bcd] JLLWrappers v1.1.3
  [9da8a3cd] JLSO v2.4.0
  [682c06a0] JSON v0.21.1
  [94ce4f54] Libiconv_jll v1.16.0+7
  [1914dd2f] MacroTools v0.5.6
  [739be429] MbedTLS v1.0.3
  [c8ffd9c3] MbedTLS_jll v2.16.8+1
  [f28f55f0] Memento v1.1.2
  [78c3b35d] Mocking v0.7.1
  [bac558e1] OrderedCollections v1.3.2
  [69de0a69] Parsers v1.0.14
  [3cdcf5f2] RecipesBase v1.1.1
  [ae029012] Requires v1.1.1
  [cea106d9] Syslogs v0.3.0
  [f269a46b] TimeZones v1.5.2
  [3bb67fe8] TranscodingStreams v0.9.5
  [5c2747f8] URIs v1.1.0
  [02c8fc9c] XML2_jll v2.9.10+3
  [ddb6d928] YAML v0.4.2
  [83775a58] Zlib_jll v1.2.11+18
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [8bb1440f] DelimitedFiles
  [8ba89e20] Distributed
  [b77e0a4c] InteractiveUtils
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [a63ad114] Mmap
  [44cfe95a] Pkg
  [de0858da] Printf
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA
  [9e88b42a] Serialization
  [1a1011a3] SharedArrays
  [6462fe0b] Sockets
  [2f01184e] SparseArrays
  [10745b16] Statistics
  [8dfed614] Test
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode
@DilumAluthge
Copy link
Member Author

The same code works fine with BSON, JLD2, JLSO, and JSON, so I think the problem is specific to YAML.

julia> import BrokenRecord

julia> import GitHub

julia> import HTTP

julia> for extension in ["bson", "jld2", "jlso", "json"]
           dir = mktempdir()
           cd(dir)
           BrokenRecord.configure!(; path=dir)
           for i = 1:4
               x = BrokenRecord.playback(() -> GitHub.repo("JuliaLang/julia"), "test.$(extension)")
               @info "" extension i typeof(x)
           end
       end
┌ Info:
│   extension = "bson"
│   i = 1typeof(x) = GitHub.Repo
┌ Info:
│   extension = "bson"
│   i = 2typeof(x) = GitHub.Repo
┌ Info:
│   extension = "bson"
│   i = 3typeof(x) = GitHub.Repo
┌ Info:
│   extension = "bson"
│   i = 4typeof(x) = GitHub.Repo
┌ Info:
│   extension = "jld2"
│   i = 1typeof(x) = GitHub.Repo
┌ Info:
│   extension = "jld2"
│   i = 2typeof(x) = GitHub.Repo
┌ Info:
│   extension = "jld2"
│   i = 3typeof(x) = GitHub.Repo
┌ Info:
│   extension = "jld2"
│   i = 4typeof(x) = GitHub.Repo
┌ Info:
│   extension = "jlso"
│   i = 1typeof(x) = GitHub.Repo
┌ Info:
│   extension = "jlso"
│   i = 2typeof(x) = GitHub.Repo
┌ Info:
│   extension = "jlso"
│   i = 3typeof(x) = GitHub.Repo
┌ Info:
│   extension = "jlso"
│   i = 4typeof(x) = GitHub.Repo
┌ Info:
│   extension = "json"
│   i = 1typeof(x) = GitHub.Repo
┌ Info:
│   extension = "json"
│   i = 2typeof(x) = GitHub.Repo
┌ Info:
│   extension = "json"
│   i = 3typeof(x) = GitHub.Repo
┌ Info:
│   extension = "json"
│   i = 4typeof(x) = GitHub.Repo

@DilumAluthge
Copy link
Member Author

Here are the contents of the test.yml file in question:

responses:
  - headers:
      - server: "github.com"
      - date: "Tue, 08 Dec 2020 02:16:07 GMT"
      - content-type: "application/json; charset=utf-8"
      - status: "200 OK"
      - cache-control: "public, max-age=60, s-maxage=60"
      - vary: "Accept, Accept-Encoding, Accept, X-Requested-With"
      - etag: "W/"87f1c54eb525ed2b0aa95a7593e66147aed32dc19bd1439b7bb0d7c09c164489""
      - last-modified: "Tue, 08 Dec 2020 01:59:29 GMT"
      - x-github-media-type: "github.v3; format=json"
      - access-control-expose-headers: "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset"
      - access-control-allow-origin: "*"
      - strict-transport-security: "max-age=31536000; includeSubdomains; preload"
      - x-frame-options: "deny"
      - x-content-type-options: "nosniff"
      - x-xss-protection: "1; mode=block"
      - referrer-policy: "origin-when-cross-origin, strict-origin-when-cross-origin"
      - content-security-policy: "default-src 'none'"
      - X-Ratelimit-Limit: "60"
      - X-Ratelimit-Remaining: "59"
      - X-Ratelimit-Reset: "1607397367"
      - X-Ratelimit-Used: "1"
      - Accept-Ranges: "bytes"
      - Content-Length: "5825"
      - X-GitHub-Request-Id: "C534:7C7F:72D1BD:13C073D:5FCEE1E6"
    body: "{"id":1644196,"node_id":"MDEwOlJlcG9zaXRvcnkxNjQ0MTk2","name":"julia","full_name":"JuliaLang/julia","private":false,"owner":{"login":"JuliaLang","id":743164,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc0MzE2NA==","avatar_url":"https://avatars0.githubusercontent.com/u/743164?v=4","gravatar_id":"","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/JuliaLang/julia","description":"The Julia Programming Language","fork":false,"url":"https://api.github.com/repos/JuliaLang/julia","forks_url":"https://api.github.com/repos/JuliaLang/julia/forks","keys_url":"https://api.github.com/repos/JuliaLang/julia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaLang/julia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaLang/julia/teams","hooks_url":"https://api.github.com/repos/JuliaLang/julia/hooks","issue_events_url":"https://api.github.com/repos/JuliaLang/julia/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaLang/julia/events","assignees_url":"https://api.github.com/repos/JuliaLang/julia/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaLang/julia/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaLang/julia/tags","blobs_url":"https://api.github.com/repos/JuliaLang/julia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaLang/julia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaLang/julia/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaLang/julia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaLang/julia/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaLang/julia/languages","stargazers_url":"https://api.github.com/repos/JuliaLang/julia/stargazers","contributors_url":"https://api.github.com/repos/JuliaLang/julia/contributors","subscribers_url":"https://api.github.com/repos/JuliaLang/julia/subscribers","subscription_url":"https://api.github.com/repos/JuliaLang/julia/subscription","commits_url":"https://api.github.com/repos/JuliaLang/julia/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaLang/julia/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaLang/julia/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaLang/julia/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaLang/julia/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaLang/julia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaLang/julia/merges","archive_url":"https://api.github.com/repos/JuliaLang/julia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaLang/julia/downloads","issues_url":"https://api.github.com/repos/JuliaLang/julia/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaLang/julia/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaLang/julia/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaLang/julia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaLang/julia/labels{/name}","releases_url":"https://api.github.com/repos/JuliaLang/julia/releases{/id}","deployments_url":"https://api.github.com/repos/JuliaLang/julia/deployments","created_at":"2011-04-21T07:01:50Z","updated_at":"2020-12-08T01:59:29Z","pushed_at":"2020-12-08T01:45:18Z","git_url":"git://github.com/JuliaLang/julia.git","ssh_url":"git@github.com:JuliaLang/julia.git","clone_url":"https://github.com/JuliaLang/julia.git","svn_url":"https://github.com/JuliaLang/julia","homepage":"https://julialang.org/","size":197019,"stargazers_count":30947,"watchers_count":30947,"language":"Julia","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4220,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":4008,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":4220,"open_issues":4008,"watchers":30947,"default_branch":"master","temp_clone_token":null,"organization":{"login":"JuliaLang","id":743164,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc0MzE2NA==","avatar_url":"https://avatars0.githubusercontent.com/u/743164?v=4","gravatar_id":"","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"network_count":4220,"subscribers_count":993}"
    status: 200
    request:
      txcount: 1
      headers:
        - User-Agent: "GitHub-jl"
        - Host: "api.github.com"
        - Content-Length: "0"
      body: ""
      method: "GET"
      target: "/repos/JuliaLang/julia"
      version: "1.1.0"
    version: "1.1.0"
format: "1.0.0"

@christopher-dG
Copy link
Member

christopher-dG commented Dec 8, 2020

That's unfortunate. Thanks for the report!

JuliaData/YAML.jl#91

There's actually already a partial fix in master, but YAML hasn't had a release in quite some time. I'll try to poke some people.

@kescobo
Copy link

kescobo commented Dec 8, 2020

I can make a release once #91 is merged.

@christopher-dG
Copy link
Member

Thank you!

@kescobo
Copy link

kescobo commented Dec 8, 2020

JuliaRegistries/General#26074

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants