Error: $map: null is not a map for 'map-get'

See original GitHub issue

I’m running Sass 3.4.7 (Selective Steve) through gulp-ruby-sass. I have a _variables.scss file with the following:

$palettes: (
    grey: (
        base:       rgb(95, 96, 98),
        mid-light:  rgb(127, 128, 129),
        light:      rgb(159, 160, 161),
        x-light:    rgb(205, 205, 205),
        xx-light:   rgb(230, 230, 230)
    ),
    purple: (
        base: rgb(70, 22, 22),
        light: rgb(110, 33, 34)
    )
);

@function palette($palette, $tone: 'base') {
    @return map-get(map-get($palettes, $palette), $tone);
}

When I compile, I get the following error:

Error: $map: null is not a map for 'map-get'
    on line 16 of /var/folders/s5/919v_t0n4v590754yhdyddy0000gn/T/gulp-ruby-sass/base/_variables.scss

I’m lost as to why this is happening.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

16reactions
gcasalettcommented, Oct 16, 2015

I know this has been closed for a while, but I wanted to chime in… I was having the same problem when I copied my color maps from one project to another (actually, I copied all the .scss files). I figured out that I was only getting that error when other .scss files were calling color palettes that did not exist in my new map. So if I was calling palette(brown), and that didn’t exist on my new map, I got the error.

Once I went through and removed all the calls to old colors, everything worked fine. Hope this helps someone!

5reactions
cimmanoncommented, Nov 12, 2014
Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular custom theme - SassError: $map: null is not a map
... but when I run "ng serve" I get the following error: SassError: $map: null is not a map. ╷ 9 │ $foreground-base:...
Read more >
is not a map for `map-get' (Example) | Treehouse Community
when i try to use a map , i get this error " $map: (("color" #ff0000), ("size" 16px), ("decoration" "uppercase")) is not a...
Read more >
sass:map
Returns null if the map does not have a value associated with the key, or if any key in $keys is missing from...
Read more >
Map (Java SE 17 & JDK 17) - Oracle Help Center
The behavior of a map is not specified if the value of an object is changed in a manner ... For example, some...
Read more >
Check if Map is Null or Empty in Java - Java Guides
isNotNullOrEmptyMap(Map, ?> map) - Return true if the supplied Map is not null or not empty. Otherwise, return false. 1. isNullOrEmptyMap() Utility Method....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found